quasilyte/kfinalize

register_shutdown_function() without limits

v1.0.1 2022-03-11 21:18 UTC

This package is not auto-updated.

Last update: 2024-04-20 07:04:24 UTC


README

KFinilize registers a script shutdown callbacks for finalization purposes. It's mostly useful in KPHP (or hybrid) applications, where you want to free some resources allocated outside of the KPHP memory context (FFI code is one of the examples).

When using multiple FFI libraries, you can at some point reach the max register_shutdown_function stack depth and your script will fail. To avoid that, KFinalize tries to aggregate all finalization needs and combine them into one shutdown callback.

Some users of this library:

  • KSQLite - a FFI-based SQLite library that can be used in both PHP and KPHP