On Fri, Apr 1, 2011 at 10:41 AM, Stephan Beal <[email protected]> wrote: > On Fri, Apr 1, 2011 at 7:59 AM, Mads Sig Ager <[email protected]> wrote: >> >> if you store and reuse your global object template you definitely have >> to put it in a persistent handle. Otherwise it will be garbage >> collected when you exit the handle scope in which the handle to it was >> created and further uses of it will lead to crashes. >> > > Minor clarification: that should say "MAY be garbage collected" or ""will be > made available for garbage collection," rather than "WILL be garbage > collected." For bound native types which require destructor calls for proper > cleanup, this distinction is significant.
No, not if you do not allocate a persistent handle and register a weak callback. The JS memory will be free for allocation as soon as the handle exits its handle scope. We are talking about an ObjectTemplate which is in the V8 heap with no associated C++ allocated data. -- Mads -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
