![]() |
Stan
1.0
probability, sampling & optimization
|
#include <chunk_alloc.hpp>
Public Member Functions | |
| chunk_alloc () | |
| Construct a resizable chunk allocator initially holding the specified number of bytes. More... | |
| ~chunk_alloc () | |
| Destroy this memory allocator. More... | |
| void * | alloc () |
| Return a newly allocated chunk of memory of the appropriate size managed by the stack allocator. More... | |
| void | recover_all () |
| Recover all the memory used by the stack allocator. More... | |
| void | free_all () |
| Free all memory used by the stack allocator other than the initial block allocation back to the system. More... | |
Definition at line 18 of file chunk_alloc.hpp.
|
inline |
Construct a resizable chunk allocator initially holding the specified number of bytes.
| std::runtime_error | if the underlying malloc is not 8-byte aligned. |
Definition at line 33 of file chunk_alloc.hpp.
|
inline |
Destroy this memory allocator.
This is implemented as a no-op as there is no destruction required.
Definition at line 47 of file chunk_alloc.hpp.
|
inline |
Return a newly allocated chunk of memory of the appropriate size managed by the stack allocator.
Definition at line 60 of file chunk_alloc.hpp.
|
inline |
Free all memory used by the stack allocator other than the initial block allocation back to the system.
Note: the destructor will free all memory.
Definition at line 94 of file chunk_alloc.hpp.
|
inline |
Recover all the memory used by the stack allocator.
The stack of memory blocks allocated so far will be available for further allocations. To free memory back to the system, use the function free_all().
Definition at line 84 of file chunk_alloc.hpp.