public void TestForMemoryLeaks() { var pool = MemoryPool.GetDefaultMemoryPool(); // Memory has yet to be allocated Assert.AreEqual(0, pool.BytesAllocated); using (var buffer = new ResizableBuffer()) { // Create parquet file with some timeseries data. CreateParquetFile(buffer); var bytesAllocatedAfterWriting = pool.BytesAllocated; Assert.Greater(bytesAllocatedAfterWriting, 0); // Read the parquet file. ReadParquetFile(buffer, pool); var bytesAllocatedAfterReading = pool.BytesAllocated; Assert.GreaterOrEqual(bytesAllocatedAfterReading, bytesAllocatedAfterWriting); } // All memory should have been released at this point. Assert.AreEqual(0, pool.BytesAllocated); }
public static void TestDefaultMemoryPool() { var pool = MemoryPool.GetDefaultMemoryPool(); Assert.AreEqual(0, pool.BytesAllocated); Assert.Greater(pool.MaxMemory, 0); Assert.AreEqual("system", pool.BackendName); using (var buffer = new ResizableBuffer()) { using var stream = new BufferOutputStream(buffer); using var fileWriter = new ParquetFileWriter(stream, new Column[] { new Column <int>("Index") }); Assert.Greater(pool.BytesAllocated, 0); Assert.Greater(pool.MaxMemory, 0); } Assert.AreEqual(0, pool.BytesAllocated); Assert.Greater(pool.MaxMemory, 0); }