140 void*
Get(
size_t size,
size_t alignment,
const type_info& dbgTypeInfo);
142 void*
Get(
size_t size,
size_t alignment
ALIB_DBG(,
const std::type_info& dbgTypeInfo) )
155 "MONOMEM/RTTRA", "Struct
RTTRAllocator cannot be used to recycle types with an alignment "
156 "smaller than ", alignof(
Node) )
161 if( !
stack.isEmpty() )
163 #if ALIB_DEBUG_MONOMEM
164 DBGMEMOUT(
"Recycling object. Type: " << DbgTypeDemangler(dbgTypeInfo).Get() )
166 return reinterpret_cast<char*>( stack.popFront() );
174 DBGMEMOUT(
"Warning: ALIB/RTTRA" )
175 DBGMEMOUT("A different
object was requested for allocation!")
178 DBGMEMOUT("Note: This
allocator may not be efficient when used." )
179 DBGMEMOUT(" If this is a use case using a 'std' library container, this message indicates" )
180 DBGMEMOUT(" that a
RTTRAllocator was shared between different container instantiations." )
181 DBGMEMOUT(" If this is not the case, than an 'unusual' implementation of such C++ library may")
182 DBGMEMOUT(" prevent this concept from working. See ALib manual for further information" )
185 DBGMEMOUT( "Allocating a different
object type \"" <<
DbgTypeDemangler(dbgTypeInfo).
Get() << "\"")
186 DBGMEMOUT( " Note: This
object cannot be recycled." )
191 #if ALIB_DEBUG_MONOMEM
209 void*
AllocUnrelated(
size_t size,
size_t alignment,
const type_info& dbgTypeInfo);
240 void Recycle(
void* mem,
size_t size,
size_t alignment,
const type_info& dbgTypeInfo );
242 void Recycle(
void* mem,
size_t size,
size_t alignment
ALIB_DBG(,
const std::type_info& dbgTypeInfo) )
247 stack.pushFront(
reinterpret_cast<Node*
>( mem ) );
248 #if ALIB_DEBUG_MONOMEM
260 DBGMEMOUT(
"Warning: ALIB/RTTRA" )
261 DBGMEMOUT( "De-allocation before a first
object allocation needed to detect recyclable type!" )
262 DBGMEMOUT( " De-allocated
object type: <" <<
DbgTypeDemangler( dbgTypeInfo ).
Get() << ">" )
263 DBGMEMOUT( "Note: This
allocator may not be efficient when used." )
264 DBGMEMOUT( " If this is a use case using a 'std' library container, this message indicates" )
265 DBGMEMOUT( " an 'unusual' implementation of such C++ standard library." )
273 DBGMEMOUT(
"Warning: ALIB/RTTRA" )
274 DBGMEMOUT( "A different
object for was requested for de-allocoation!" )
277 DBGMEMOUT( "Note: This
allocator may not be efficient when used." )
278 DBGMEMOUT( " If this is a use case using a 'std' library container, this message indicates" )
279 DBGMEMOUT( " that a
RTTRAllocator was shared between different container instantiations." )
280 DBGMEMOUT( " If this is not the case, than an 'unusual' implementation of such C++ library may")
281 DBGMEMOUT( " prevent this concept from working. See ALib manual for further information" )
306 void RecycleChunk(
void* mem,
size_t size,
const type_info& dbgTypeInfo );
308 void RecycleChunk(
void* memUnaligned,
size_t size
ALIB_DBG(,
const std::type_info& dbgTypeInfo) )
312 if( !TAllocator::allowsMemSplit() )
325 DBGMEMOUT(
"Warning: ALIB/RTTRA" )
326 DBGMEMOUT( "De-allocation before a first
object allocation needed to detect recyclable type!" )
327 DBGMEMOUT( " De-allocated
object type: <" <<
DbgTypeDemangler( dbgTypeInfo ).
Get() << ">." )
328 DBGMEMOUT( "Note: If this recycler is used with a 'std' library container, this either" )
329 DBGMEMOUT( " indicates an 'unusual' implementation of such C++ standard library," )
330 DBGMEMOUT( " or a manual shrink of the capacity without any prior
object insertion." )
340 size-= size_t(mem -
reinterpret_cast<char*
>(memUnaligned));
343 ALIB_DBG(
size_t cntStackedObjects= 0; )
346 stack.pushFront(
reinterpret_cast<Node*
>( mem ) );
355 if( cntStackedObjects > 0 )
357 DBGMEMOUT(
"Warning: ALIB/RTTRA" )
358 DBGMEMOUT( "De-allocated chunk's size is smaller than detected
object size." )
359 DBGMEMOUT( " Deallocated
object: Type: <" << DbgTypeDemangler( dbgTypeInfo ).
Get() << ">" )
360 DBGMEMOUT( " Size: " << origSize << " bytes" )
363 DBGMEMOUT( "Note: If this recycler is used with a <std::unordered_map> or <std::unordered_set>," )
364 DBGMEMOUT( " this message may be eliminated by reserving a reasonable initial bucket size." )
368 #if ALIB_DEBUG_MONOMEM
369 DBGMEMOUT(
"ALIB/MEMORY" )
370 DBGMEMOUT( "Stacking " << cntStackedObjects << " objects from de-allocated memory of size "
372 << " bytes). Deallocated type: " << DbgTypeDemangler(dbgTypeInfo).
Get() )