From: Shawn O. Pearce Date: Fri, 16 Jul 2010 17:41:09 +0000 (-0700) Subject: Discard the uncompressed delta as soon as its compressed X-Git-Tag: v0.9.1~157^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=12fe0f2d1eb18aab2964532e99d11d4311d558eb;p=jgit.git Discard the uncompressed delta as soon as its compressed The DeltaCache will most likely need to copy the compressed delta into a new buffer in order to compact away the wasted space at the end caused by over allocation. Since we don't need the uncompressed format anymore, null out our only reference to it so the GC can reclaim this memory if it needs to perform a collection in order to satisfy the cache's allocation attempt. Change-Id: I50403cfd2e3001b093f93a503cccf7adab43cc9d Signed-off-by: Shawn O. Pearce --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaWindow.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaWindow.java index ee865fbe5a..6521e6d3ec 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaWindow.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaWindow.java @@ -330,6 +330,7 @@ class DeltaWindow { ZipStream zs = new ZipStream(deflater(), zbuf); bestDelta.writeTo(zs, null); + bestDelta = null; int len = zs.finish(); resObj.setCachedDelta(deltaCache.cache(zbuf, len, rawsz));