I'm creating objects (with c++ objects attached) from within the javascript. the only way I found to call the destuctor of the c++ object while the javascript ist running ist the makeweak-callback, whitch can only be attached to a pesistent object.
by the way, the problem with the 160000 objects had nothing to do with the pesistent objects. my fault was, to create a template for every new object. now i use a global template and the problem is gone. On 29 Sep., 09:01, "Simon Ask Ulsnes" <[EMAIL PROTECTED]> wrote: > Question of interest: Why use a Persistent handle if it's going to be > deleted at some point other than process termination? > > - Simon > > 2008/9/29 bell <[EMAIL PROTECTED]>: > > > > > > > can you tell me, how to delete the Persistent-handle? can i do this in > > the callback? I tried obj.Dispose() obj.Clear() and obj.ClearWeak(), > > but nothing changed the behaviour. > > > On 28 Sep., 21:40, "Christian Plesner Hansen" > > <[EMAIL PROTECTED]> wrote: > >> > unfortuanatly, when i have allocated and deallocated about 160000 > >> > objects, my program crashes. it looks like the GarbageCollector isn't > >> > freeing the Persistent Object after calling theMakeWeak-callback. > > >> > in my callback i only delete my c++ object, do i have to do something > >> > with the Persistent<Object> ? > > >> Yes. The garbage collector intentionally does not dispose the > >> persistent handle, you have to do that yourself. It also does not > >> collect the javascript object, since it is being kept alive by the > >> handle. The reason for this is that it gives you the option to keep > >> the object alive after you get the callback, which is necessary under > >> some circumstances. Only if you dispose the handle, and there are no > >> more persistent handles to the object, does it actually get collected.- > >> Zitierten Text ausblenden - > > - Zitierten Text anzeigen - --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
