메소드 | 설명 | |
---|---|---|
Allocate ( ) : byte[] |
Allocates a chunk of memory. If memory is cached it is returned. If no memory is cached then it is allocated. Check the size of the returned buffer to determine how much memory was allocated.
|
|
Free ( byte data ) : void |
Frees an unused buffer. This may be added to the cache.
|
|
MemoryCache ( int bufferSize, int maxCachedBuffers ) : System |
Initializes a new instance of the MemoryCache class.
|
메소드 | 설명 | |
---|---|---|
GetStartingOffset ( ) : int |
Get the offset in the cached buffers array to start allocating or freeing buffers to. This is done so that all threads don't start operating on slot zero, which would increase contention.
|
public MemoryCache ( int bufferSize, int maxCachedBuffers ) : System | ||
bufferSize | int | /// The size of the buffers to cache. /// |
maxCachedBuffers | int | /// The maximum number of buffers to cache. /// |
리턴 | System |