[Chicago-talk] linked list of object

Andy_Bach@wiwb.uscourts.gov Andy_Bach at wiwb.uscourts.gov
Wed Nov 9 12:36:35 PST 2005


Hey.

Our main program uses a linked list of objects and passes around global 
pointers to the head of the list.  They often walk the chain by:
 my $LocalList = $main::gListPtr;

  while ($LocalList) {
....
   $LocalList = $LocalList->next();
  }

(yes, the next() method returns the next object).  Just looking at some 
code where they undef() the global pointer before appending a new list and 
got to wondering if GC would be then able to recover the 'orphaned' 
objects.  The first on the list won't have an refs so it can go and so the 
2nd ... etc.  Just wondering if this *not* a good idea or what a way to 
examine the memory overhead.

Thanks.

a

Andy Bach, Sys. Mangler
Internet: andy_bach at wiwb.uscourts.gov 
VOICE: (608) 261-5738  FAX 264-5932

"Reality is that which, when you don't believe in it, doesn't 
go away." Peter Viereck


More information about the Chicago-talk mailing list