Yes, that's how a WeakCell works.

I'm not sure, however, I understand what you're doing with the slots there,
and what you mean by the WeakCell becoming free space (the WeakCell should
always stay alive, it's just the link to whatever object it points to that
gets cleared)?

On Sun, Dec 11, 2016 at 1:05 AM <[email protected]> wrote:

> Does anyone know how to create weak references internally in V8? I came
> across the WeakCell type (subclassed from HeapObject) in src/objects.h. It
> provides methods cleared() and value(), and I guess the cleared() method is
> used to test if the referenced object has been freed by the GC, while
> value() gives pointer to the referenced object. Is this understanding
> correct?
>
> I have created a couple Object ** slots to store pointers to WeakCell *.
> During GC I iterated the Object ** slots using VisitPointer(). But after a
> few GC cycles (~2) I would see some WeakCell's become free space. Is this
> the correct behavior? If it becomes free space, immediately after GC (I
> hooked GarbageCollectionEpilogue), can we safely assume that the referenced
> object has been recycled?
>
> --
> --
> 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/d/optout.
>

-- 
-- 
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/d/optout.

Reply via email to