On Thu, Jun 9, 2011 at 8:52 AM, CodeJunkie <[email protected]> wrote:
> Now X is lost and dangling. The C++ destructor is never called, even > at program exit. Don't get lured into that false sense of security (as i did). v8 does NOT guaranty that GC will EVER be called, including at app exit. It does not do a full GC at exit (supposedly as a performance boost when closing tabs in Chrome, if my memory serves me correctly). That means that when wrapping types which REQUIRE destructor calls for proper semantics, you must add functions to those objects which performs such cleanup, and call those functions from your JS code. The canonical examples are file handles and db connections, which would have a close() member (or similar) which cleans up the native object and sets up the object state so that future method calls on that object will not step on a destructed pointer. -- ----- stephan beal http://wanderinghorse.net/home/stephan/ -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
