Blender V5.0
MemoryAllocator< N > Class Template Reference

#include <MemoryAllocator.h>

Inherits VirtualMemoryAllocator.

Public Member Functions

 MemoryAllocator ()
void destroy () override
void * allocate () override
void deallocate (void *obj) override
void printInfo () override
int getAllocated () override
int getAll () override
int getBytes () override
Public Member Functions inherited from VirtualMemoryAllocator
virtual ~VirtualMemoryAllocator ()=default

Detailed Description

template<int N>
class MemoryAllocator< N >

Dynamic memory allocator - allows allocation/deallocation

NOTE: there are 4 bytes overhead for each allocated yet unused object.

Definition at line 46 of file MemoryAllocator.h.

Constructor & Destructor Documentation

◆ MemoryAllocator()

template<int N>
MemoryAllocator< N >::MemoryAllocator ( )
inline

Constructor

Definition at line 102 of file MemoryAllocator.h.

References HEAP_BASE, i, N, and UCHAR.

Member Function Documentation

◆ allocate()

template<int N>
void * MemoryAllocator< N >::allocate ( )
inlineoverridevirtual

Allocation method

Implements VirtualMemoryAllocator.

Definition at line 141 of file MemoryAllocator.h.

References HEAP_BASE.

◆ deallocate()

template<int N>
void MemoryAllocator< N >::deallocate ( void * obj)
inlineoverridevirtual

De-allocation method

Implements VirtualMemoryAllocator.

Definition at line 155 of file MemoryAllocator.h.

References HEAP_BASE, and UCHAR.

◆ destroy()

template<int N>
void MemoryAllocator< N >::destroy ( )
inlineoverridevirtual

Destructor

Implements VirtualMemoryAllocator.

Definition at line 125 of file MemoryAllocator.h.

References free(), and i.

◆ getAll()

template<int N>
int MemoryAllocator< N >::getAll ( )
inlineoverridevirtual

Implements VirtualMemoryAllocator.

Definition at line 187 of file MemoryAllocator.h.

Referenced by printInfo().

◆ getAllocated()

template<int N>
int MemoryAllocator< N >::getAllocated ( )
inlineoverridevirtual

Query methods

Implements VirtualMemoryAllocator.

Definition at line 182 of file MemoryAllocator.h.

Referenced by printInfo().

◆ getBytes()

template<int N>
int MemoryAllocator< N >::getBytes ( )
inlineoverridevirtual

Implements VirtualMemoryAllocator.

Definition at line 192 of file MemoryAllocator.h.

References N.

Referenced by printInfo().

◆ printInfo()

template<int N>
void MemoryAllocator< N >::printInfo ( )
inlineoverridevirtual

Print information

Implements VirtualMemoryAllocator.

Definition at line 170 of file MemoryAllocator.h.

References getAll(), getAllocated(), getBytes(), and printf.


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