use of org.neo4j.io.fs.PhysicalFlushableChannel in project neo4j by neo4j.
the class PhysicalFlushableChannelTest method releaseBufferMemoryOnClose.
@Test
void releaseBufferMemoryOnClose() throws IOException {
var memoryTracker = new LocalMemoryTracker();
final Path firstFile = directory.homePath().resolve("file2");
StoreChannel storeChannel = fileSystem.write(firstFile);
PhysicalLogVersionedStoreChannel versionedStoreChannel = new PhysicalLogVersionedStoreChannel(storeChannel, 1, (byte) -1, firstFile, nativeChannelAccessor);
assertThat(memoryTracker.estimatedHeapMemory()).isZero();
assertThat(memoryTracker.usedNativeMemory()).isZero();
try (PhysicalFlushableChannel channel = new PhysicalFlushableChannel(versionedStoreChannel, memoryTracker)) {
channel.put((byte) 1);
assertThat(memoryTracker.usedNativeMemory()).isZero();
assertThat(memoryTracker.estimatedHeapMemory()).isGreaterThan(0);
}
assertThat(memoryTracker.estimatedHeapMemory()).isZero();
assertThat(memoryTracker.usedNativeMemory()).isZero();
}
Aggregations