ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::monomem Namespace Reference

Description:

This ALib Module implements the concept of "monotonic allocation" by providing the central classes TMonoAllocator and TPoolAllocator.

Please consult ALib Module Memory - Programmer's Manual for further information.

Nested Namespaces:

namespace  detail
 Details of namespace alib::monomem.
 

Type Index:

struct  DbgStatistics
 
class  Snapshot
 
struct  Statistics
 
class  TLocalAllocator
 
class  TMonoAllocator
 
class  TPoolAllocator
 
class  TSharedMonoVal
 

Function Index:

template<typename TAllocator>
NAString DbgDumpStatistics (monomem::TMonoAllocator< TAllocator > &ma)
 

Variable Index:

ALIB_DLL TMonoAllocator< lang::HeapAllocatorGLOBAL_ALLOCATOR
 
ALIB_DLL RecursiveLock GLOBAL_ALLOCATOR_LOCK
 

Function Details:

◆ DbgDumpStatistics()

template<typename TAllocator>
NAString alib::monomem::DbgDumpStatistics ( monomem::TMonoAllocator< TAllocator > & ma)

Provides allocation statistics for manual performance optimization.

Availability
This method is included only in debug-compilations and when module ALib Strings is included in the ALib Build.
In case the code selector symbol ALIB_DEBUG_MEMORY is set, additional information retrieved with TMonoAllocator::DbgGetStatistics is included in the generated string.
Parameters
maThe allocator to get formatted statistics for.
Returns
Some textual information on the allocation statistics.

Variable Details:

◆ GLOBAL_ALLOCATOR

ALIB_DLL TMonoAllocator<lang::HeapAllocator> alib::monomem::GLOBAL_ALLOCATOR
extern

This is the global monotonic allocator singleton instance. It's initial size defaults to \ 128 kilobytes. This can be tweaked by performing a placement-new on this instance before bootstrapping ALib.

See also

◆ GLOBAL_ALLOCATOR_LOCK

ALIB_DLL RecursiveLock alib::monomem::GLOBAL_ALLOCATOR_LOCK
extern

This mutex is used to protect the GLOBAL_ALLOCATOR from racing conditions in multithreaded software.
If the compiler-symbol ALIB_DEBUG_CRITICAL_SECTIONS is set, this lock will be attached to the DbgCriticalSections instance in GLOBAL_ALLOCATOR during bootstrap. Thus, an assertion will be raised if the GLOBAL_ALLOCATOR is used without locking this mutex.
This is a recursive lock. This allows using the high-level allocation interface with allocations, which constructs objects. These objects might recursively use the global allocator for their members.