|
CookMem 1.4.0
A C++ memory context / allocator
|
#include <allocator.h>
Public Member Functions | |
| TLSContextScope () | |
| TLSContextScope (bool shareArena) | |
| TLSContextScope (const TLSContextScope &)=delete | |
| TLSContextScope & | operator= (const TLSContextScope &)=delete |
| Context & | getContext () |
Temporarily provides a function-scope context to default-constructed allocators using the matching TLSContextProvider.
Declare the scope before containers that use the context so those containers are destroyed before the context.
|
inline |
Constructor. Creates a new context with its own arena and makes it the active context of the current thread until the scope ends.
|
inlineexplicit |
Constructor. Creates a new context based on the persistent thread-local context and makes it the active context of the current thread until the scope ends.
| shareArena | true to share the arena of the persistent thread-local context. With CachedMemContext, segments freed by either context can then be reused by the other. false to give the new context its own arena. |
|
inline |
Get the memory context of this scope.