Class ProxyMemoryPool
- Namespace
- ParquetSharp
- Assembly
- ParquetSharp.dll
A memory pool that forwards all allocations to another memory pool, while tracking its own statistics independently.
public sealed class ProxyMemoryPool : MemoryPool, IDisposable
- Inheritance
-
ProxyMemoryPool
- Implements
- Inherited Members
Remarks
The statistics of a proxy memory pool only include allocations made through the proxy, so creating a separate proxy for each writer allows tracking the memory used by each writer, even when they share the same underlying memory pool.
Unlike the global memory pools, a proxy memory pool owns a native resource. It should not be disposed until every object that was configured to use it has been disposed, for example any writer, reader, properties or output stream it was passed to. After disposal, statistics are no longer available and the pool cannot be used to configure new objects. Objects already using the pool keep the native pool alive so that disposing it early does not cause memory errors, but continuing to use them after the pool is disposed is not recommended.
Memory allocated from the pool may safely outlive it, for example buffers or Arrow arrays read using it. The native pool is only freed once all allocations made through it have been freed, so statistics are no longer available after disposal but the memory remains valid.
Constructors
ProxyMemoryPool(MemoryPool)
Create a new proxy memory pool that forwards allocations to the specified memory pool.
public ProxyMemoryPool(MemoryPool wrappedPool)
Parameters
wrappedPoolMemoryPoolThe memory pool to forward allocations to
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()