"Sean O'Rourke" <[EMAIL PROTECTED]> writes:

> On Mon, 26 Aug 2002, Nicholas Clark wrote:
> > All ways of doing deterministic destruction seem to have considerable
> > overhead.
> 
> One possible alternative would be to have file handles and other objects
> with destructors that have to be called in a timely fashion keep
> ref-counts.  When the refcount drops to zero, they release whatever
> critical resource they are holding.  Then the GC comes by later to reclaim
> the memory.

Dont know if this would be a good idea. If you put an deterministic
destruction object into an compund object. Then the compound object
must also be deterministic destructed, that meens also
refcounted. Otherwise the compound object lays around until the next
DOD run (which can be anytime) holding a reference an prohibiting the
destruction of the deterministic destruction object. Next all objects
holding references to the compound object must also be refcounted to
ensure timely destruction. This continues the hole way down to the
root set. So a big part of the memory will be refcounted.

Finding all this references to refcounted objects is a series of DOD
runs. As long as there is found at least one not refcounted object, a
new DOD must be triggered to make sure that no further refrences
exist. Only if the compound object the deterministic destruct object
is added is already refcounted then its just an increase of one refcount.

So there are two ways out. Do refcounting for all objects so there are
no recursive DOD runs needed. AFAIK this is the perl5 way. But it
would be a major effort and a big design change in parrot bringing
refcounting into the core even as a Config time (or may be loadtime or
runtime) option.

The other way is live with the many DOD runs for getting the refcounts
right, but then you may get arround with a one bit refcount, because
you have to iterate over the children anyway. If there is a
(interpreter-)global needs_more_DODs variable the recursive DODs can
be defered till the next assignment or block exit. But this is exactly
what Nicholas Clark proposed just using diffrent names (deterministic
destruction flag and loose object counter(|flag?). 

bye
boeboe

-- 
Juergen Boemmels                        [EMAIL PROTECTED]
Fachbereich Physik                      Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern             Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F  23 F6 C7 2F 85 93 DD 47

Reply via email to