Browse Source

dfs: actually allow current DfsBlock to GC

Holding the current DfsBlock in a local variable 'b' may prevent the
Java GC from reclaiming it while loading the next block.  Remove the
local variable and rely only on the field.

Change-Id: Ibfc8394cac717b485fdc94d5c8479c3f8ca78ee4
stable-4.9
Shawn Pearce 7 years ago
parent
commit
da0a7c1f3c
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java

3
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java

@ -757,8 +757,7 @@ public class DfsReader extends ObjectReader implements ObjectReuseAsIs {
}
void pin(DfsPackFile pack, long position) throws IOException {
DfsBlock b = block;
if (b == null || !b.contains(pack.key, position)) {
if (block == null || !block.contains(pack.key, position)) {
// If memory is low, we may need what is in our window field to
// be cleaned up by the GC during the get for the next window.
// So we always clear it, even though we are just going to set

Loading…
Cancel
Save