Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Pool ¶
func CreatePool ¶
CreatePool creates a new memory pool with a fixed number of blocks (numBlocks) and size of each block (blockSize).
func (*Pool) Allocate ¶
Allocate returns a new slice where len and cap equals `blockSize`. If the limit of `numBlocks` concurrent allocations is reached, ErrOutOfMemory is returned.
func (*Pool) DeAllocate ¶
DeAllocate releases a previous allocated slice. In case of passing an invalid slice, ErrOutOfBound is returned. Furthermore the released slice must have the same start position provided by allocate.
Click to show internal directories.
Click to hide internal directories.