It will be freed, you just don't have any control over when unless you  
use external garbage collection.

Objects in v8 exist outside of contexts, so their weak handle callback  
will get called whenever v8 garbage collects, even if "their" context  
dies (as, since the object is not tied to a single context, it never  
has a context that can die). So as long as v8 is still being used for  
any scripts, you won't have any leaks, because garbage collection will  
keep occurring.

You don't have to worry about memory leaks, because when the  
application itself dies, all of its memory will be freed by the  
operating system.

The only times you need external garbage collection, from what I can  
tell, are when destructors must be called, which is only necessary  
when doing file i/o, etc, with resources that must be explicitly closed.

Alex

On Mar 9, 2009, at 2:52 PM, Stephan Beal wrote:

> But even if i registered it for gc via a weak pointer callback, it's
> not guaranteed to be freed, so i'm forced to add external gc to it in
> *any* case and have the client call the cleanup routine when their
> context dies (this is currently handled via a sentry object in the
> client app which cleans up when it goes out of scope).

Alex Iskander, TPSi





--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to