On Fri, Apr 26, 2013 at 9:54 PM, Vyacheslav Egorov <[email protected]>wrote:
> > So it is possible that persistent weak handles built on top of > primitive values did not collected? > > Boolean values are eternal --- they never die. Small integers (31 bits on > ia32 and 32bits on x64) are not even allocated in the heap, they are > *values* essentially so weak reachability is undefined for them. > > > it is safe return persistent handle via raw return handle; instead of > return handle_scope.Close(handle); ? > > Yes. You need to use Close only for Local handles. If you return > Persistent handle you can just return that directly. > Note, however, that we're currently working on removing the common base class between Persistent and Local. In the future, you'll have to explicitly convert the Persistent to a Local and return it via handle_scope.Close(). Passing back a Persistent handle effectively creates a new Handle pointing to the same global cell. If you now invoke Dispose on the Persistent handle, the copy will point to an invalid memory location. By first creating a Local handle and then returning it, you can avoid this situation. best -jochen > > -- > Vyacheslav Egorov > > > On Fri, Apr 26, 2013 at 12:42 PM, Dmitry Azaraev <[email protected]> wrote: > >> Hi. >> >> My question initially originated from CEF V8 integration, described on >> next issues: >> https://code.google.com/p/chromiumembedded/issues/detail?id=323 , >> https://code.google.com/p/chromiumembedded/issues/detail?id=960 . >> >> In short problem looks as: >> CEF creates persistent and weak handles for every created V8 value ( >> Boolean, Integers ). And in this case i found memory leak, when for example >> our native function returns primitive value. For complex values (Object), >> this is did not appear at all. >> >> So it is possible that persistent weak handles built on top of primitive >> values did not collected? >> >> And additional question: it is safe return persistent handle via raw >> return handle; instead of return handle_scope.Close(handle); ? >> >> -- >> -- >> v8-users mailing list >> [email protected] >> 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 [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > Vyacheslav Egorov > Software Engineer > Google Danmark ApS - Skt Petri Passage 5, 2 sal - 1165 København K - > CVR nr. 28 86 69 84 > > -- > -- > v8-users mailing list > [email protected] > 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 [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- v8-users mailing list [email protected] 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
