On Mar 10, 2:13 am, Alex Iskander <[email protected]> wrote:
> v8 does not own the native C++ objects; C++ owns them. V8 simply owns  
> handles to pointers (externals) to C++ objects. The MakeWeak fubction  
> is meant specifically to tell you when JavaScript is no longer using  
> the object; it is not meant to destroy the object. Why should it waste  
> valuable CPU time at application exit, causing it to take as long to  
> close as Adobe InDesign, Testing each and every object to see if it  
> MIGHT be referenced by any weak handles, so that it can tell you that  
> the object is no longer being used by JavaScript -- something you  
> should already know, since the application is exiting.

If that's not what they're for, they're being misrepresented. It's
advertised as "you'll get notified when we're done with." Well, when a
context closes, "the context is done with it," so it should tell us.
Otherwise we get a half-ass solution - we never know if our callbacks
will be called.

> When NOT at application exit, none of this is a concern, because, as  
> long as you are still using v8, the garbage will be collected  
> eventually; and, if necessary, you can make it occur more often so the  
> scripting uses less memory.

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.

The WeakJSClassGenerator i just posted will save me a lot of grief on
this front, though -i've not got guaranteed dtos as long as main()
exits normally (as opposed to abort() or a signal).

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

Reply via email to