PackWriter#prepareBitmapIndex: add clarifying comments
New readers of #prepareBitmapIndex may be confused about the manual memory management (hidden mutation and nulling out pointers). Add two clarifying comments to help future readers. Change-Id: I93cab1919066efda37e96c47667f6991f67e377e
This commit is contained in:
parent
fb3fd69584
commit
6722f25d56
|
@ -2371,10 +2371,14 @@ public boolean prepareBitmapIndex(ProgressMonitor pm) throws IOException {
|
||||||
|
|
||||||
int numCommits = objectsLists[OBJ_COMMIT].size();
|
int numCommits = objectsLists[OBJ_COMMIT].size();
|
||||||
List<ObjectToPack> byName = sortByName();
|
List<ObjectToPack> byName = sortByName();
|
||||||
|
// Reset sortedByName before the array that it points to is mutated by
|
||||||
|
// PackBitmapIndexBuilder, to prevent other methods referencing the
|
||||||
|
// mutated array afterwards.
|
||||||
sortedByName = null;
|
sortedByName = null;
|
||||||
objectsLists = null;
|
objectsLists = null;
|
||||||
objectsMap = null;
|
objectsMap = null;
|
||||||
writeBitmaps = new PackBitmapIndexBuilder(byName);
|
writeBitmaps = new PackBitmapIndexBuilder(byName);
|
||||||
|
// Allow byName to be GC'd if JVM GC runs before the end of the method.
|
||||||
byName = null;
|
byName = null;
|
||||||
|
|
||||||
PackWriterBitmapPreparer bitmapPreparer = new PackWriterBitmapPreparer(
|
PackWriterBitmapPreparer bitmapPreparer = new PackWriterBitmapPreparer(
|
||||||
|
|
Loading…
Reference in New Issue