4. The method of claim 1 , wherein an old generation of an application comprises the plurality of old regions, wherein the application is one of a plurality of applications.
1. A method for garbage collection comprising: determining a plurality of old regions associated with an application; obtaining a root for the application, wherein the root is for traversing an object graph of live objects for the application; creating a mark bitmap by traversing the object graph using the root, wherein the mark bitmap describes a plurality of marked words for the plurality of old regions and a plurality of unmarked words for the plurality of old regions; creating a connectivity matrix by traversing the object graph using the root, wherein the connectivity matrix describes a plurality of cross-region references; scanning the mark bitmap to obtain fragmentation information; selecting a first region of the plurality of old regions; determining that the first region satisfies a fragmentation threshold using the fragmentation information; in response to determining that the first region satisfies the fragmentation threshold: copying at least one of the plurality of marked words located in the first region to a new region allocated from a pool of free regions; adjusting a cross-region reference to the first region in the plurality of marked words to point to the new region based on the connectivity matrix; and adding the first region to the pool of free regions; determining that a second region from the plurality of old regions does not satisfy the fragmentation threshold; in response to determining that the second region does not satisfy the fragmentation threshold, designating each of the plurality of unmarked words in the second region as free.