> Does the first line mean that it decrements a reference count to the storage
> cell?

No, it frees the storage cell immediately.

> Why is the handle not made empty? Presumably I wouldn't call Dispose unless I
> was finished with using the object it referenced.

Handles are passed by value so you will typically have a number of
copies of the handle you're freeing, all pointing to the same storage
cell.  Even if we clear the pointer from the handle you're disposing,
all the other copies will still point to the address where the cell
was.

> Could I still use the
> handle to get at the object until it is collected?

No, all access to an object held in a persistent handle goes through
the storage cell so it is not safe to try to access the object after
the cell has been freed.

> Should I normally call Clear() after Dispose()?

You can, just be aware that you're only clearing one handle and there
may be other copies of it that are unaffected by the call to Clear.

> Should I always call Dispose() before Clear()?

It depends on how you use persistent handles but usually yes.
Persistent handles are not garbage collected so if you're done using
one you have to dispose it before clearing, otherwise it will leak.

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to