On Mar 9, 2009, at 9:58 PM, Stephan Beal wrote:

> Well, when a context closes, "the context is done with it," so it  
> should tell us.

Here is the crucial thing: the CONTEXT cannot be done with it. v8 as a  
whole can be done with it. The garbage collection does not occur per  
context, but through the entire v8 instance. Your callbacks will be  
called when garbage collects; they do not belong to one context or  
another.

This is because one object can be used from more than one context in v8.

Again, the only catch is application exit. But in that situation, you  
know v8 is no longer using the resource anyway, so can handle it with  
your automatic destruction sentry.

> i don't want to fudge the memory size just to force gc. That's way too
> vague and kludgy, and there's no guaranty the user hasn't set some
> arbitrarily small limit which i might, though my abuse of the gc
> engine, violate.


There is also a way to specify memory limits for v8, which would have  
a similar effect. The documentation is rather spotty, but it is used  
in some of v8's tests. v8, since it stops JavaScript each time it  
garbage collects, tries to do so only when it needs to. So, you have  
to tell it how to decide it needs to.

Alex Iskander, TPSi





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

Reply via email to