C# Class GSF.IO.Unmanaged.MemoryPoolPageList

Maintains a list of all of the memory allocations for the buffer pool.
This class is not thread safe.
Inheritance: IDisposable
Datei anzeigen Open project: GridProtectionAlliance/openHistorian Class Usage Examples

Public Properties

Property Type Description
MemoryPoolCeiling long
PageSize int

Public Methods

Method Description
Dispose ( ) : void

Disposes of all of the memory on the list.

GrowMemoryPool ( long size ) : bool

Grows the buffer pool to have the desired size

MemoryPoolPageList ( int pageSize, long maximumBufferSize ) : System

Create a thread safe list of MemoryPool pages.

ReleasePage ( int index ) : void

Releases a block back to the pool so it can be re-allocated.

SetMaximumPoolSize ( long value ) : long

Changes the allowable buffer size

ShrinkMemoryPool ( long size ) : long

Tries to shrink the buffer pool to the provided size

The buffer pool shrinks to a size less than or equal to size.

TryGetNextPage ( int &index, IntPtr &addressPointer ) : bool

Requests a new block from the buffer pool.

Private Methods

Method Description
CalculateMemoryBlockSize ( int pageSize, long totalSystemMemory ) : int

Calculates the desired allocation block size to request from the OS.

The recommended block size is the totalSystemMemory divided by 1000 but must be a multiple of the system allocation size and the page size and cannot be larger than 1GB

CalculateMemoryPoolCeiling ( int memoryBlockSize, long systemTotalPhysicalMemory ) : long

Computes the ceiling of the buffer pool

Method Details

Dispose() public method

Disposes of all of the memory on the list.
public Dispose ( ) : void
return void

GrowMemoryPool() public method

Grows the buffer pool to have the desired size
public GrowMemoryPool ( long size ) : bool
size long
return bool

MemoryPoolPageList() public method

Create a thread safe list of MemoryPool pages.
public MemoryPoolPageList ( int pageSize, long maximumBufferSize ) : System
pageSize int The desired page size. Must be between 4KB and 256KB
maximumBufferSize long The desired maximum size of the allocation. Note: could be less if there is not enough system memory. /// A value of -1 will default based on available system memory
return System

ReleasePage() public method

Releases a block back to the pool so it can be re-allocated.
public ReleasePage ( int index ) : void
index int the index identifier of the block
return void

SetMaximumPoolSize() public method

Changes the allowable buffer size
public SetMaximumPoolSize ( long value ) : long
value long the number of bytes to set.
return long

ShrinkMemoryPool() public method

Tries to shrink the buffer pool to the provided size
The buffer pool shrinks to a size less than or equal to size.
public ShrinkMemoryPool ( long size ) : long
size long The size of the buffer pool
return long

TryGetNextPage() public method

Requests a new block from the buffer pool.
Thrown if the list is full
public TryGetNextPage ( int &index, IntPtr &addressPointer ) : bool
index int the index identifier of the block
addressPointer System.IntPtr the address to the start of the block
return bool

Property Details

MemoryPoolCeiling public_oe property

The maximum supported number of bytes that can be allocated based on the amount of RAM in the system. This is not user configurable.
public long MemoryPoolCeiling
return long

PageSize public_oe property

Each page will be exactly this size (Based on RAM)
public int PageSize
return int