memory defragmentation

Godmar Back gback at cs.utah.edu
Mon Feb 15 18:30:15 PST 1999


 Dave,

> 
> Moreover, since we've got ambiguous pointers, we can't move an object
> without tracing all pointers to it to make sure that none of them are
> ambiguous.  The only sensible time to do this tracing is at GC-time,
> so we may as well make a copying collector.  Yum.  :)
> 
> Bartlett's (1992) Mostly Copying collector would be good, except that
> it assumes that only the roots are ambiguous and that all objects are
> movable if not referenced from the roots.  Neither of these conditions
> apply in Kaffe.  We've got ambiguous pointers in the JIT code (that
> is, when I poke around in JIT code I find a lot of numbers
> corresponding to addresses of CLASS objects), and we've got lots of
> objects that can't be moved (GC_ALLOC_FIXED).  The problem needs more
> study, but I suspect that a MC-based collector would keep unacceptable
> amounts of tenured garbage, because it hangs onto whole blocks if
> there any ambiguous pointers reference them.
> 

I don't want to pretend to be a gc expert, but let me make two comments
here:

First, I don't think that GC_ALLOC_FIXED objects are a problem, for two
reasons.  For one, these objects are not only non-moveable, but they are
not subject to gc at all.  Basically, they're like memory alloced and freed
with malloc/free.  As such, I would suspect that they are subject to the
trade-offs of malloc implementations, which form a whole research area by
themself.  Plus, it's known at allocation time whether an object is of
allocation type GC_ALLOC_FIXED.  Hence, their allocation could be done 
completely independent of the other objects.

Second, about the Class objects.  I realize that moving them would be
complicated, but they are a) rare compared to other objects and b) their
lifetimes follow a distinct pattern.  In particular, all classes loaded
by the system loader will never be gc'ed in Kaffe, and all classes loaded
by a particular classloader will be gc'ed at the same time.  I think that's
something the allocator should know about and exploit, if at all possible.

	- Godmar



More information about the kaffe mailing list