Managing Memory

To allocate memory dynamically, call:

    mymem = (void*)R3Alloc(int size, int flags);

This attemps to allocate 'size' bytes of memory. If there is not enough memory the function gives an error message and returns NULL. Set flags to R3MEMF_CLEAR if you want the function to clear the memory chunk to be allocated.

To Free the allocated memory call:

    R3Free(int mymem, int size);

function. Note that the size must match the size passed to R3Alloc();

To Free the allocated memory call:

    R3Free(int mymem, int size);

function. Note that the size must match the size passed to R3Alloc();

[Important] Important
Using these functions for all memory allocation is highly recommended. There is a special Realsoft 3D Debug version which takes advantage of these functions and helps you to find bugs.