Patent ID: 7769974

Claim:
A computerized method comprising: monitoring an executing program in order to determine which of a plurality of objects in a heap are recently accessed by the executing program; upon determining that a heap object was accessed by the executing program, manipulating at least one bit within a heap object to indicate the recent heap object access; monitoring a program performance metric which measures performance or behavior of the program while the program is running in order to determine when to perform a heap optimization; invoking the heap optimization based upon the monitored program performance metric; and performing the heap optimization comprising traversing the heap to identify the recently accessed heap objects as indicated by the manipulated at least one bit within accessed heap objects, clustering the recently accessed heap objects in memory by temporarily copying the recently accessed heap objects out of the heap rearranged according to a hierarchical decomposition order and locating the rearranged recently accessed heap objects at a younger end of a generational garbage collected heap, and resetting the manipulated at least one bit for each accessed heap object, wherein the at least one bit then representing recent accesses by the executing program since a last performed heap optimization.