Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.4.4, 1.5.0
-
None
-
None
Description
The InMemoryMap class uses a SourceSwitchingIterator to enable switching over from iterating through memory to through a dump file. The switching iterator uses a MemoryDataSource which maintains a list of the dump file iterators (readers) in use. The MemoryIterator, when closing, uses this list to close the readers.
However, two different MemoryDataSource instances are constructed when iteration is established.
MemoryDataSource mds = new MemoryDataSource(); // MDS #1 SourceSwitchingIterator ssi = new SourceSwitchingIterator(new MemoryDataSource()); // MDS #2 MemoryIterator mi = new MemoryIterator(new PartialMutationSkippingIterator(ssi, mc)); mi.setSSI(ssi); mi.setMDS(mds);
MDS #2 is the one that the switching iterator uses and which maintains the reader list. However, MDS #1 is the one that the memory iterator looks at during closing for readers to close, but it is never used. It's highly likely that the same instance should be used for both.