Hi, Currently exit() is implemented using bailout and unclean shutdown, which means that we're going to perform a longjmp back to the top-level scope and let the memory manager clean up all the memory it knows about. Anything not allocated using ZMM is going to leak persistently.
For me, one of the most annoying things about this is that we can't perform proper leak checks on code using PhpUnit, because it will always exit() at the end, which will result in "expected" memory leaks. I think it would be good to switch exit() to work by throwing a magic exception, similar to what Python does. This would allow us to properly unwind the stack, executing finally blocks (which are currently skipped) and perform a clean engine shutdown. Depending on the implementation, we could also allow code to actually catch this exception, which may be useful for testing scenarios, as well as long-running daemons. I'm mainly wondering how exactly we'd go about integrating this in the existing exception hierarchy. Assuming that it is desirable to allow people to actually catch this exception, my first thought would be along these lines: Throwable (convert to abstract class) \-> Exception \-> Error \-> ExitThrowable This does mean though that existing code using catch(Throwable) is going to catch exit()s as well. This can be avoided by introducing *yet another* super-class/interface above Throwable, which is something I'd rather avoid. Anyone have thoughts on this matter? Nikita