On Tue, Jan 28, 2014 at 9:20 AM, Pierre Saunier < pierre.saun...@ppmodeler.com> wrote:
> Thanks a lot, I figure it also... But, I have still 3 (related) questions: > Why Persistent are not a subclass of handle? so that it is possible to use > Handle (Local) and persistent in the same way, without the need to do a > cast? And what is the difference between a weak and non weak persistent? > A weak persistent does not keep an object alive: if only weak handles are pointing to a given object, it's still garbage collected. That's also the reason you can't use a persistent as a handle. If it's a weak persistent, the object can be garbage collected at any time, even while you've passed the value e.g. as an parameter to another function. By keeping persistent and handle apart, you're forced to first create a strong reference to the object before you can use it. > How can I know if a persistent is referenced or not in v8 engine? > If I create a Local Object, how can I know when it is deleted? if I use > the internal field to strore some allocated data, how can I know when to > delete it? simply having a list of the allocated stuff, and delete them > before the end of the handle scope? > > If you make a persistent weak, you will have to specify a callback. This callback is invoked by V8 if it wants to garbage collect the object. best -jochen > > > -- > -- > v8-users mailing list > v8-users@googlegroups.com > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to the Google Groups > "v8-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to v8-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.