Patent ID: 7412466

Claim:
A method for compacting a computer memory heap, comprising: logically partitioning the heap into a plurality of chunks, wherein the heap comprises a plurality of reachable objects, and wherein each of the reachable objects has a starting address within an associated one of the plurality of chunks; wherein each of the reachable objects comprises one or more reachable memory locations; identifying, between a start of a particular one of the plurality of chunks and a start of one of the reachable memory locations within that chunk, one or more gaps comprising one or more unreachable memory locations; and determining, for each of two or more of the reachable memory locations within the particular one of the plurality of chunks, a post-compaction destination address, wherein each said post-compaction destination address is determined according to a post-compaction destination address for the particular one of the plurality of chunks, according to an offset corresponding to the respective reachable memory location's location in the heap relative to a start of the particular one of the plurality of chunks, and accounting for the one or more identified gaps, wherein the post-compaction destination address for the particular one of the plurality of chunks is dependent on a total size of one or more reachable memory locations located at heap address closer to the direction of compaction that the start of the particular one of the plurality of chunks.