preillyme/v8js — pull request #67 by stesie (2013-10-26 16:44:14+00:00)
Title: Fix garbage collection

AFAICS the garbage collection has been broken since when V8Js makes use of isolates. This is due to the idle notifications being processed on the default isolate, if no different isolate is active. Since this was never the case, they never did anything.

Besides I noticed that the weak object callbacks are not triggered by V8 if cells are freed on isolate disposal, hence we're not decreasing the reference counter of exported PHP objects correctly.

This commit is based on the ZTS fixes by @cscott, not yet merged to master.

It removes the old garbage collection stuff, including the php.ini setting and sends idle notifications unconditionally on V8Js object destruction. This triggers the weak object callbacks and frees the PHP objects as needed.

Besides I remove the global PHP object from JS on destruction, so all the attached properties are freed also, leading to de-referencing of exported PHP objects (so they're not leaked anymore)