Status: New
Owner: ----
New issue 3128 by [email protected]: Adding a Weak Persistent Handle
leads to Objects not being freed by GC
http://code.google.com/p/v8/issues/detail?id=3128
I'm encountering some strange behavior with weak persistent handles.
when I add a weak persistent handle for referencing a V8 object from a C++
object nothing will be freed anymore when freeing the Context.
I've tried to illustrate the references in the below text. ( | means
reference, contained object means C++ object assigned to internal field of
the V8 Object)
Global Object
|
JavaScript Object
|
V8 Object A, has numerous weak references to JavaScript objects and a weak
persistent handle from the contained C++ object to the V8 object for GC
|
V8 Object B <-- has a persistent reference to a V8 String; when adding a
weak persistent handle to the contained C++ object to be able to free the
C++ object nothing will be freed anymore
Without the reference using a weak persistent handle from the contained C++
object to the V8 Object B, everything is freed. The weak callback of V8
Object A is called and the weak callback of the V8 Context is also getting
called. Just by adding the following two lines of code the GC fails.
persistentHandleForObjectB.Reset(isolate, objectB);
persistentHandleForObjectB.SetWeak(this, weakCallback);
In this case no weak callback will be called upon freeing the Context.
I'm note sure but I believe the addition of a weak reference should not
lead to Objects not being garbage collected.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" 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.