[Parrot-users] Use of vtable "destroy"

Andrew Whitworth wknight8111 at gmail.com
Thu Dec 29 13:11:53 UTC 2011


Great questions. This is the kind of thing we should have more
documentation on in the future.

The destroy vtable is called when the object is collected by the
garbage collector. Because it is called during a sensitive point in
the interpreter execution (in the GC, as the PMC is being destroyed) I
wouldn't try to do too much processing in that vtable, but that's more
of a hunch than an actual rule. Honestly, the destroy vtable is not
used very often.

We used to have a notion of "timely destruction", or PMCs which needed
to be collected as quickly as possible. That doesn't really work with
our newest GC algorithm.  We don't have a way to manually destroy a
PMC at the moment, but we could possibly add that in the future if
there was a demand for it. The programmer would be responsible to
guarantee that the PMC only had one surviving reference and that it
was never accessed again after being destroyed, of course.

What is your use-case? What are you trying to accomplish with this? If
we know a little bit more about what you need we can help find a good
solution for you.

--Andrew Whitworth



On Thu, Dec 29, 2011 at 5:04 AM, S'orlok Reaves <sorlok_reaves at yahoo.com> wrote:
> Good evening,
>
>       I'm having a hard time finding information on this: is "destroy" the
> correct method to override if I want something to be performed whenever an
> object is deleted? I did some searching through src/pmc/object.c, and
> "destroy" was the only method that seemed relevant.
>
>      If not, then what method should I use?
>
>      If so, then I have a follow-up question: What are the guarantees of
> object deletion? Will outstanding objects be deleted when the VM exits
> normally? Is there any way to force an object to be collected/deleted at
> some arbitrary point in time (e.g., when a function exits)?
>
>     I checked through the Parrot docs, but couldn't find anything on object
> deletion. If I missed an obvious source of information, I apologize.
>
> Thanks,
> -->Seth
>
> _______________________________________________
> Parrot-users mailing list
> Parrot-users at lists.parrot.org
> http://lists.parrot.org/mailman/listinfo/parrot-users
>


More information about the Parrot-users mailing list