Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ogdf::MallocMemoryAllocator Class Reference

Implements a simple memory manager using malloc() and free(). More...

#include <ogdf/basic/memory/MallocMemoryAllocator.h>

Classes

struct  MemElem
 

Public Member Functions

 MallocMemoryAllocator ()
 
 ~MallocMemoryAllocator ()
 

Static Public Member Functions

static voidallocate (size_t nBytes)
 Allocates memory of size nBytes.
 
static voidallocate (size_t nBytes, const char *, int)
 Allocates memory of size nBytes.
 
static constexpr bool checkSize (size_t)
 Always returns true since we simply trust malloc().
 
static void cleanup ()
 
static void deallocate (size_t, void *p)
 Deallocates memory at address p. We do not keep track of the size of the deallocated object.
 
static void deallocateList (size_t, void *pHead, void *pTail)
 Deallocate a complete list starting at pHead and ending at pTail.
 
static void flushPool ()
 
static void flushPool (uint16_t)
 
static constexpr size_t memoryAllocatedInBlocks ()
 Always returns 0, since no blocks are allocated.
 
static constexpr size_t memoryInFreelist ()
 Always returns 0, since no blocks are allocated.
 
static constexpr size_t memoryInGlobalFreeList ()
 Always returns 0, since no blocks are allocated.
 
static constexpr size_t memoryInThreadFreeList ()
 Always returns 0, since no blocks are allocated.
 

Private Types

using MemElemPtr = MemElem *
 

Detailed Description

Implements a simple memory manager using malloc() and free().

Definition at line 41 of file MallocMemoryAllocator.h.

Member Typedef Documentation

◆ MemElemPtr

Constructor & Destructor Documentation

◆ MallocMemoryAllocator()

ogdf::MallocMemoryAllocator::MallocMemoryAllocator ( )
inline

Definition at line 49 of file MallocMemoryAllocator.h.

◆ ~MallocMemoryAllocator()

ogdf::MallocMemoryAllocator::~MallocMemoryAllocator ( )
inline

Definition at line 51 of file MallocMemoryAllocator.h.

Member Function Documentation

◆ allocate() [1/2]

static void * ogdf::MallocMemoryAllocator::allocate ( size_t  nBytes)
inlinestatic

Allocates memory of size nBytes.

Definition at line 59 of file MallocMemoryAllocator.h.

◆ allocate() [2/2]

static void * ogdf::MallocMemoryAllocator::allocate ( size_t  nBytes,
const char ,
int   
)
inlinestatic

Allocates memory of size nBytes.

Definition at line 56 of file MallocMemoryAllocator.h.

◆ checkSize()

static constexpr bool ogdf::MallocMemoryAllocator::checkSize ( size_t  )
inlinestaticconstexpr

Always returns true since we simply trust malloc().

Definition at line 89 of file MallocMemoryAllocator.h.

◆ cleanup()

static void ogdf::MallocMemoryAllocator::cleanup ( )
inlinestatic

Definition at line 53 of file MallocMemoryAllocator.h.

◆ deallocate()

static void ogdf::MallocMemoryAllocator::deallocate ( size_t  ,
void p 
)
inlinestatic

Deallocates memory at address p. We do not keep track of the size of the deallocated object.

Definition at line 69 of file MallocMemoryAllocator.h.

◆ deallocateList()

static void ogdf::MallocMemoryAllocator::deallocateList ( size_t  ,
void pHead,
void pTail 
)
inlinestatic

Deallocate a complete list starting at pHead and ending at pTail.

The elements are assumed to be chained using the first word of each element.

Definition at line 75 of file MallocMemoryAllocator.h.

◆ flushPool() [1/2]

static void ogdf::MallocMemoryAllocator::flushPool ( )
inlinestatic

Definition at line 84 of file MallocMemoryAllocator.h.

◆ flushPool() [2/2]

static void ogdf::MallocMemoryAllocator::flushPool ( uint16_t  )
inlinestatic

Definition at line 86 of file MallocMemoryAllocator.h.

◆ memoryAllocatedInBlocks()

static constexpr size_t ogdf::MallocMemoryAllocator::memoryAllocatedInBlocks ( )
inlinestaticconstexpr

Always returns 0, since no blocks are allocated.

Definition at line 92 of file MallocMemoryAllocator.h.

◆ memoryInFreelist()

static constexpr size_t ogdf::MallocMemoryAllocator::memoryInFreelist ( )
inlinestaticconstexpr

Always returns 0, since no blocks are allocated.

Definition at line 95 of file MallocMemoryAllocator.h.

◆ memoryInGlobalFreeList()

static constexpr size_t ogdf::MallocMemoryAllocator::memoryInGlobalFreeList ( )
inlinestaticconstexpr

Always returns 0, since no blocks are allocated.

Definition at line 98 of file MallocMemoryAllocator.h.

◆ memoryInThreadFreeList()

static constexpr size_t ogdf::MallocMemoryAllocator::memoryInThreadFreeList ( )
inlinestaticconstexpr

Always returns 0, since no blocks are allocated.

Definition at line 101 of file MallocMemoryAllocator.h.


The documentation for this class was generated from the following file: