Arena that allocates memory in blocks and frees it all at destruction.
Synopsis
Declared in <folly/memory/Arena.h>
template<class Alloc>
class Arena;
Description
Memory obtained from allocate() stays alive until the arena is cleared or destroyed; individual deallocations are no‐ops. Blocks come from the user‐supplied allocator Alloc.
Member Functions
Name |
Description |
|
Constructors |
|
Destroys the arena, freeing every block it owns. |
Assignment operators |
|
Allocates a properly aligned chunk of memory from the arena. |
|
Gets the total number of "used" bytes. |
|
Resets the arena, reusing regular blocks and freeing large ones. |
|
Releases memory back to the arena; this is intentionally a no‐op. |
|
Transfers ownership of all memory allocated from |
|
Gets the total memory used by the arena. |
Static Data Members
Name |
Description |
Per‐block bookkeeping overhead, in bytes. |
|
Default maximum alignment, in bytes, honored by allocations. |
|
Default minimum size, in bytes, of each regular block. |
|
Sentinel value meaning the arena has no total size limit. |