ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-internals
perl6-internals
Re: GMC for dummies
by Leopold Toetsch other posts by this author
Jul 18 2005 8:07AM messages near this date
Re: GMC for dummies | Re: GMC for dummies
Bob Rogers wrote:
>     From: Leopold Toetsch <lt@[...].at>
>     Date: Sun, 17 Jul 2005 12:08:34 +0200
>  
>     > What happens when a store creates a cycle?  And how would this be
>     > detected?
>  
>     To keep the invariant we can't move the container nor the contained 
>     object, *if* both are aggregates. Therefore the pointer store will be 
>     recorded on the IGP list. Thus there is no need to detect cycles.
>  
>  But when are objects taken off the IGP list?  This is not contemplated
>  in [1], which explicitly mentions as a drawback that circular structures
>  cannot be recovered [2], and it is not (yet) addressed in the GMC design
>  [3].

Circular or not isn't really the problem. With generational GC you'll 
always have the chance of tenured garbage. E.g.

    gen n           |      gen j
    [ A ]           |      [ C ]
      ^                      |
      +----------------------+

We got a reverse pointer, which needs remembering on the IGP list of 
generation n. IGPn then becomes part of the root set of this generation 
n and the object A is marked and kept alive. So far so good.

Now due to some other pointer store the object C becomes dead. But as 
long as we don't scan up to generation j, we don't realize this and 
object A stays alive.

This is usually not a problem, just some waste of memory, except when 
the object A needs timely destruction. In such a case we would have to 
scan more generations, up to generation j in the above case.
As object C belongs to generation j, the IGP entry that marks A would 
become invalid, because the object C (and its refered contents) have to 
be anchored somwhere else to be alive.

    gen n           |       gen j
    [ A ] ->  [ B ] -|-----> [ C ]
      ^                      |
      +----------------------+

A circular data structure doesn't really change the picture, except, 
when again scanning up to generation j, and we find object C being 
alive, we'd have to restart scanning at object A, by following the 
backreference.
If non of A, B, or C is referenced from elsewhere, we would still delete 
the whole reference loop.

>  ...  Is one-pass mark-sweep really a suitable GC algorithm for Parrot?

I still think it's suitable yes. It's only in the above case that we 
can't immediately cleanup A, because of the invalidation of the IGP entry.

>  					-- Bob

leo
Thread:
Nattfodd
Nattfodd
Leopold Toetsch
Bob Rogers
Leopold Toetsch
Bob Rogers
Leopold Toetsch
Bob Rogers
Leopold Toetsch
Nattfodd
Bob Rogers
Alexandre Buisse
Bob Rogers
Nicholas Clark
Bob Rogers
Nattfodd
Bob Rogers
Nattfodd
Leopold Toetsch
Nattfodd
Leopold Toetsch
Nattfodd

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved