Dura2D  v0.1.0
An educational 2D game physics library
Loading...
Searching...
No Matches
d2BlockAllocator Class Reference

The d2BlockAllocator class is responsible for managing memory allocation and deallocation. It maintains a list of free blocks of different sizes, and can allocate and deallocate blocks of memory. More...

#include <d2BlockAllocator.h>

Public Member Functions

 d2BlockAllocator ()
 Default constructor.
 
 ~d2BlockAllocator ()
 Destructor.
 
void * Allocate (int32 size)
 Allocates a block of memory of the specified size.
 
void Free (void *p, int32 size)
 Frees a block of memory.
 
void Clear ()
 Clears all allocated blocks.
 

Detailed Description

The d2BlockAllocator class is responsible for managing memory allocation and deallocation. It maintains a list of free blocks of different sizes, and can allocate and deallocate blocks of memory.

Constructor & Destructor Documentation

◆ d2BlockAllocator()

d2BlockAllocator::d2BlockAllocator ( )

Default constructor.

◆ ~d2BlockAllocator()

d2BlockAllocator::~d2BlockAllocator ( )

Destructor.

Member Function Documentation

◆ Allocate()

void * d2BlockAllocator::Allocate ( int32 size)

Allocates a block of memory of the specified size.

Parameters
sizeThe size of the block to allocate
Returns
A pointer to the allocated block

◆ Clear()

void d2BlockAllocator::Clear ( )

Clears all allocated blocks.

◆ Free()

void d2BlockAllocator::Free ( void * p,
int32 size )

Frees a block of memory.

Parameters
pA pointer to the block to free
sizeThe size of the block to free

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