#include <OnixS/CME/MDH/MemoryPool.h>
Pool instances created by makeMemoryPool() own their allocated storage and destroy themselves through release(). They are not deleted directly.
- Note
- The interface provides no synchronization. Callers must serialize concurrent access to the same pool.
Definition at line 51 of file MemoryPool.h.
◆ MemoryPool()
Initializes the base of a concrete pool implementation.
◆ ~MemoryPool()
|
|
protectedvirtualdefaultnoexcept |
Finalizes the base of a concrete pool implementation.
- Note
- Pool users destroy instances through release().
◆ allocate()
| virtual void * allocate |
( |
size_t | size | ) |
|
|
pure virtual |
Obtains a raw memory block.
- Parameters
-
| size | Required capacity in bytes. |
- Returns
- Pointer to the allocated storage.
- Exceptions
-
| std::length_error | If the requested allocation or configured chunk is too large. |
| std::bad_alloc | If storage cannot be allocated. |
◆ deallocate()
| virtual void deallocate |
( |
void * | block | ) |
|
|
pure virtualnoexcept |
Returns a previously allocated block to its owning pool.
- Parameters
-
- Note
- Passing nullptr has no effect.
◆ release()
Destroys this pool and releases its storage.
- Precondition
- Every outstanding allocation has been returned with deallocate().
- Note
- The pool pointer and all storage obtained from it become invalid.