Loading...
Searching...
No Matches
Memory Management

Functions having to do with memory allocation/handling. More...

Files

file  align.h
 Provide architecture-specific memory-alignment information.
 
file  mallocHook.h
 Routines for controlling malloc behavior.
 

Classes

class  ArchMallocHook
 Override default malloc() functionality. More...
 

Macros

#define ARCH_MAX_ALIGNMENT_INCREASE
 Maximum extra space needed for alignment.
 
#define ARCH_CACHE_LINE_SIZE
 The size of a CPU cache line on the current processor architecture in bytes.
 

Functions

size_t ArchAlignMemorySize (size_t nBytes)
 Return suitably aligned memory size.
 
void * ArchAlignMemory (void *base)
 Align memory to the next "best" alignment value.
 
ARCH_API void * ArchAlignedAlloc (size_t alignment, size_t size)
 Aligned memory allocation.
 
ARCH_API void ArchAlignedFree (void *ptr)
 Free memory allocated by ArchAlignedAlloc.
 
ARCH_API bool ArchIsPtmallocActive ()
 Return true if ptmalloc is being used as the memory allocator.
 
ARCH_API bool ArchIsStlAllocatorOff ()
 Return true if the C++ STL allocator was requested to be turned off.
 

Detailed Description

Functions having to do with memory allocation/handling.

Macro Definition Documentation

◆ ARCH_CACHE_LINE_SIZE

#define ARCH_CACHE_LINE_SIZE

The size of a CPU cache line on the current processor architecture in bytes.

Definition at line 84 of file align.h.

◆ ARCH_MAX_ALIGNMENT_INCREASE

#define ARCH_MAX_ALIGNMENT_INCREASE

Maximum extra space needed for alignment.

The ArchAlignMemorySize() can increase the required memory by no more than ARCH_MAX_ALIGNMENT_INCREASE.

Definition at line 64 of file align.h.

Function Documentation

◆ ArchAlignedAlloc()

ARCH_API void * ArchAlignedAlloc ( size_t  alignment,
size_t  size 
)

Aligned memory allocation.

◆ ArchAlignedFree()

ARCH_API void ArchAlignedFree ( void *  ptr)

Free memory allocated by ArchAlignedAlloc.

◆ ArchAlignMemory()

void * ArchAlignMemory ( void *  base)
inline

Align memory to the next "best" alignment value.

This will take a pointer and bump it to the next ideal alignment boundary that will work for all data types.

Definition at line 72 of file align.h.

◆ ArchAlignMemorySize()

size_t ArchAlignMemorySize ( size_t  nBytes)
inline

Return suitably aligned memory size.

Requests to malloc() or ::new for a given size are often rounded upward. Given a request for nBytes bytes of storage, this function returns the amount that would actually be consumed by the system to satisfy it. This is needed for efficient user-defined memory management.

Definition at line 54 of file align.h.

◆ ArchIsPtmallocActive()

ARCH_API bool ArchIsPtmallocActive ( )

Return true if ptmalloc is being used as the memory allocator.

ptmalloc3 is an external shared library providing implementations of the standard memory allocation functions (e.g. malloc, free). Consumers with special behavior that depends on this library may use this function to determine if it is the active allocator.

◆ ArchIsStlAllocatorOff()

ARCH_API bool ArchIsStlAllocatorOff ( )

Return true if the C++ STL allocator was requested to be turned off.

Under gcc, this is done by setting the environment variable GLIBCXX_FORCE_NEW, but it might differ (or not even be possible) for other platforms.