The performance of automatic memory management may be improved if the polic
ies used in allocating and collecting objects had knowledge of the lifetime
s of objects. To date, approaches to the pretenuring of objects in older ge
nerations have relied on profile-driven feedback gathered from trace runs.
This feedback has been used to specialize allocation sites in a program. Th
ese approaches suffer from a number of limitations. We propose an alternati
ve that through efficient sampling of objects allows for on-line adaption o
f allocation sites to improve the efficiency of the memory system. In doing
so, we make use of a facility already present in many collectors such as t
hose found in Java(TM) virtual machines: weak references. By judiciously tr
acking a subset of allocated objects with weak references, we are able to g
ather the necessary statistics to make better object-placement decisions.