guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Garbage Collection questions


From: Sam Tregar
Subject: Re: Garbage Collection questions
Date: Sun, 13 May 2001 19:41:44 -0400 (EDT)

On 14 May 2001, Marius Vollmer wrote:

> Sam Tregar <address@hidden> writes:
>
> > It's very easy to tell if a Perl variable is still live - just check to
> > see if it's refcount is >0.
>
> Is that true?  How can you legally observe an object with a refcount
> of zero?

Good catch!  Yes, if the variable has actually had its refcount reach zero
then you're right, trying to examine the refcount is not going to work.
The more usual case is checking to see if a mortal variable's refcount is
one before exiting the block in which it was declared.

There is some support in Perl for weak references which don't cause
seg-faults after the referenced object is destroyed.  Weak references
could be used to find out if a variable is still alive after it has died.

-sam





reply via email to

[Prev in Thread] Current Thread [Next in Thread]