We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
ReferencesComputer Graphics KitC/C++CG Rendering FrameworkClass SummaryMemoryAllocator

MemoryAllocator

Expand

Class Info

class MemoryAllocator

A memory allocator.

Public Constructor Summary

Expand

Constructor Name

MemoryAllocator()

A constructor.

Public Destructor Summary

Expand

Destructor Name

~MemoryAllocator()

A destructor.

Public Method Summary

Expand

Qualifier and Type

Method Name and Description

void*

Alloc(u64 size, u64 alignment = alignof(f64))

Allocates memory aligned by alignment bits.

inline void

Flush()

Frees memory.

template<typename T, u64 ALIGN = alignof(T), typename... ARGS> T*

Allocate(ARGS&& ... args)

Allocates memory and initializes an object.

void

Free(void* p, u64 size)

Frees a resource.

Public Constructors

MemoryAllocator

Expand

Constructor

MemoryAllocator()

A constructor.

Public Destructors

~MemoryAllocator

Expand

Destructor

~MemoryAllocator()

A destructor.

Public Methods

Alloc

Expand

Method

void* Alloc(u64 size, u64 alignment = alignof(f64))

Allocates memory aligned by alignment bits.

Parameters

Expand

Name

Description

size

Memory size, in bytes.

alignment

Number of alignment bits.

Flush

Expand

Method

inline void Flush()

Frees memory.

Allocate

Expand

Method

template<typename T, u64 ALIGN = alignof(T), typename... ARGS> T* Allocate(ARGS&& ... args)

Allocates memory and initializes an object.

Parameters

Expand

Name

Description

args

Initialization object argument.

Free

Expand

Method

void Free(void* p, u64 size)

Frees a resource.

Parameters

Expand

Name

Description

p

Resource pointer.

size

Resource size.

Search in References
Enter a keyword.