Свойство | Type | Description | |
---|---|---|---|
PageMask | int | ||
PageShiftBits | int | ||
PageSize | int |
Méthode | Description | |
---|---|---|
AllocatePage ( int &index, |
Requests a page from the buffered pool. If there is not a free one available, method will block and request a collection of unused pages by raising RequestCollection event. IMPORTANT NOTICE: Be careful when calling this method as the calling thread will block if no memory is available to have a background collection to occur. There is a possiblity for a deadlock if calling this method from within a lock. The page allocated will not be initialized, so assume that the data is garbage. |
|
Dispose ( ) : void |
Releases all the resources used by the MemoryPool object.
|
|
MemoryPool ( int pageSize = 64*1024, long maximumBufferSize = -1, TargetUtilizationLevels utilizationLevel = TargetUtilizationLevels.Low ) : System |
Creates a new MemoryPool.
|
|
ReleasePage ( int pageIndex ) : void |
Releases the page back to the buffer pool for reallocation. The page released will not be initialized. Releasing a page is on the honor system. Rereferencing a released page will most certainly cause unexpected crashing or data corruption or any other unexplained behavior. |
|
ReleasePages ( IEnumerable |
Releases all of the supplied pages
|
|
SetMaximumBufferSize ( long value ) : long |
Changes the allowable buffer size
|
|
SetTargetUtilizationLevel ( TargetUtilizationLevels utilizationLevel ) : void |
Changes the utilization level
|
Méthode | Description | |
---|---|---|
CalculateStopShrinkingLimit ( long size ) : long |
Calculates at what point a collection cycle will cease prematurely.
|
|
CalculateThresholds ( long maximumBufferSize, TargetUtilizationLevels levels ) : void | ||
GetCollectionLevelBasedOnSize ( long size ) : int |
Gets the number of collection rounds base on the size.
|
|
GetCollectionLevelString ( int iterations ) : string | ||
RemoveDeadEvents ( ) : void |
Searches the collection events and removes any events that have been collected by the garbage collector.
|
|
RequestMoreFreeBlocks ( ) : void |
Determines whether to allocate more memory or to do a collection cycle on the existing pool.
|
public AllocatePage ( int &index, |
||
index | int | the index id of the page that was allocated |
addressPointer | outputs a address that can be used /// to access this memory address. You cannot call release with this parameter. /// Use the returned index to release pages. | |
Résultat | void |
public MemoryPool ( int pageSize = 64*1024, long maximumBufferSize = -1, TargetUtilizationLevels utilizationLevel = TargetUtilizationLevels.Low ) : 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. |
utilizationLevel | TargetUtilizationLevels | Specifies the desired utilization level of the allocated space. |
Résultat | System |
public ReleasePage ( int pageIndex ) : void | ||
pageIndex | int | A value of zero or less will return silently |
Résultat | void |
public ReleasePages ( IEnumerable |
||
pageIndexes | IEnumerable |
A collection of pages. |
Résultat | void |
public SetMaximumBufferSize ( long value ) : long | ||
value | long | the number of bytes to set. |
Résultat | long |
public SetTargetUtilizationLevel ( TargetUtilizationLevels utilizationLevel ) : void | ||
utilizationLevel | TargetUtilizationLevels | |
Résultat | void |