renoir::IAllocator

Allocator interface used by Rendering Library for all memory allocations. The user has to provide an object that implements this interface.

#include <CoherentRenderingLibrary.h>

Public Functions

Name
virtual void *Allocate(unsigned size) =0
Allocate size bytes.
virtual void *Reallocate(void * ptr, unsigned size) =0
Reallocates the given area of memory. It must be previously allocated by Allocate.
virtual voidDeallocate(void * ptr) =0
Deallocates the memory previously allocated by Allocate.
virtual void *AlignedAllocate(unsigned size, unsigned alignment) =0
Allocate size bytes whose alignment is specified by alignment.
virtual voidAlignedDeallocate(void * ptr) =0
Deallocates the memory previously allocated by AlignedAllocate.
virtual~IAllocator()
IAllocator()

Public Functions Documentation

function Allocate

virtual void * Allocate(
    unsigned size
) =0

Allocate size bytes.

Parameters:

  • size the number of bytes to allocate

Return: the pointer to the beginning of newly allocated memory.

function Reallocate

virtual void * Reallocate(
    void * ptr,
    unsigned size
) =0

Reallocates the given area of memory. It must be previously allocated by Allocate.

Parameters:

  • ptr the pointer to the memory area to be reallocated
  • size number of bytes to allocate

function Deallocate

virtual void Deallocate(
    void * ptr
) =0

Deallocates the memory previously allocated by Allocate.

Parameters:

  • ptr the pointer to the memory to deallocate

function AlignedAllocate

virtual void * AlignedAllocate(
    unsigned size,
    unsigned alignment
) =0

Allocate size bytes whose alignment is specified by alignment.

Parameters:

  • size number of bytes to allocate
  • alignment specifies the alignment

Return: the pointer to the beginning of newly allocated memory.

function AlignedDeallocate

virtual void AlignedDeallocate(
    void * ptr
) =0

Deallocates the memory previously allocated by AlignedAllocate.

Parameters:

  • ptr the pointer to the memory to deallocate

function ~IAllocator

virtual ~IAllocator()

function IAllocator

IAllocator()