[gclist] zillion objects
Thu, 23 Aug 2001 19:33:27 -0700
j> This question is a general one. In brief: if you have a large
j> number of objects, a small fraction of which die (very slowly), is
j> there a method of automatic memory management (i.e., gc), which
j> would not (1) try to copy most of those objects or (2) trace most
j> of those pointers?
I believe what you're looking for is the "free lunch" memory
management scheme :-)
Seriously, if you have foreknowledge of the lifetimes of your objects,
you could allocate them in arenas. An arena contains a large pile of
objects which, either by definition or because you can afford it, all
die at once when the entire arena is freed in a single action.
You never need to check the liveness of objects within an arena, but
you had better be sure that you won't need any of them after you free
it. This style of allocation has its applications, but it is
obviously not generally useful.
In the general case, the cost of generational collection is relatively
low if you have enough generations, although you pay in increased
volumes of yet-to-be-collected garbage.