GC: Trim EWAHCompressedBitmaps to free unused memory
The "Building bitmaps" GC phase fails for large repositories (repos with 10M objects use 1.25MB per uncompressed bitmap, and those with long histories may build >25k bitmaps). Since these bitmaps xor well against each other, the actual space needed for each compressed bitmap is usually no more than a few KB. Calling trim() will ensure we aren't holding on to excess memory. Change-Id: I40bf78c730b9f6051da6025f9777ce27220a5b0a Signed-off-by: Terry Parker <tparker@google.com>
This commit is contained in:
parent
dd7d479bd4
commit
04b9f44367
|
@ -351,6 +351,7 @@ public StoredEntry next() {
|
|||
PositionEntry entry = positionEntries.get(item);
|
||||
if (entry == null)
|
||||
throw new IllegalStateException();
|
||||
bestBitmap.trim();
|
||||
return new StoredEntry(entry.namePosition, bestBitmap,
|
||||
bestXorOffset, item.getFlags());
|
||||
}
|
||||
|
|
|
@ -200,6 +200,7 @@ public EWAHCompressedBitmap getBitmap(AnyObjectId objectId) {
|
|||
for (IntIterator i = oldBitmap.getBitmap().intIterator(); i.hasNext();)
|
||||
inflated.set(prevToNewMapping[i.next()]);
|
||||
bitmap = inflated.toEWAHCompressedBitmap();
|
||||
bitmap.trim();
|
||||
convertedBitmaps.add(
|
||||
new StoredBitmap(objectId, bitmap, null, oldBitmap.getFlags()));
|
||||
return bitmap;
|
||||
|
|
Loading…
Reference in New Issue