<p style="color:rgb(34,34,34);background-color:rgb(255,255,255);clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
Garbage collectors move data to eliminate holes in virtual memory both to make new allocations faster and to make it feasible to allocate large contiguous chunks.</p><p style="color:rgb(34,34,34);background-color:rgb(255,255,255);clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
In modern 64-bit OSes two significant optimization possibilities seem to arise. One is to simply not do compaction. Instead, unmap pages that contain no live objects and keep allocating new objects to further and further areas of virtual memory by mapping pages in. On a 64-bit system this could be pretty sustainable. The other possibility is that if a large object does need to be compacted/moved to a different virtual address, then the pages that contain it could simply be remapped to a different area of virtual memory without copying any data.</p>
<p style="color:rgb(34,34,34);background-color:rgb(255,255,255);clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
There would be extra work, relative to copying, for reorganizing the page tables, but I think that might be logarithmically smaller.</p><p style="color:rgb(34,34,34);background-color:rgb(255,255,255);clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
This seems to ensure that there is no hole larger than a page. Sparsely occupied pages could be copied as usual or with some bookkeeping used for allocating small objects.</p><p style="color:rgb(34,34,34);background-color:rgb(255,255,255);clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;margin:0px 0px 1em;word-wrap:break-word;border:0px;padding:0px">
Is there a problem in this scheme? Are there any JVMs out there that do this or are shortly expected to do so?</p>