On 24 October 2013 11:20, Sven Panne <[email protected]> wrote:
> On Thu, Oct 24, 2013 at 11:00 AM, Yorath Wang <[email protected]> wrote:
>>
>> Thanks for your reply.
>> I use while (!v8::V8::IdleNotification()) {} force gc to release the
>> memory, but that callback is not called either.
>> Could you please show me a right way to use SetWeak to avoid memroy leak?
>> Thanks
>
> To shorten this discussion a bit: Using weak callbacks (a.k.a. finalizers)
> will never give you any guarantees if/when they are called, it is just based
> on best-effort. If you really need timely destruction, you will need some
> form of explicit API for the kind of objects you are working with.

Right, and just to be clear: that is true for just about any
finalisation mechanism. Since this is such a frequent question, let me
reiterate two fundamental wisdoms regarding GC:

1. Forcing GC explicitly almost always trades bad behaviour for worse behaviour.
2. Finalisation almost always is the wrong solution to the wrong problem.

And once you start violating the former just to work around the
consequences of violating the latter, you are definitely in the
non-exceptional case of either. ;)

/Andreas

-- 
-- 
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.

Reply via email to