Synopsis

PDX_MSGT mda_Malloc(long option, void *ent, size_t size, void *ptr)

Purpose

Database memory allocator.

Description

The amount of memory specified by size is allocated. If ent is not NULL, the memory is associated with the specified entity and will be swapped to and from memory when that entity is swapped. If ent is NULL the memory can later be added to an entity using mda_AddMemory.

Note that the ptr argument is the address of the pointer to the allocated memory. This must be a field within the entity pointed to by ent unless ent is NULL. The field can not be a variably dimensioned array (i.e. one with more than one variable dimension). Use mda_MallocArray to allocate a variably dimensioned array.

Input

option

MDA_ZERO_DATA

This option is provided for backwards compatibility, mda_Malloc will always initialize the allocated memory to 0.

ent

The entity which owns the allocated memory or NULL

size

The number of bytes to allocate

ptr

Address to store the allocated memory pointer at

Output

ptr

The allocated memory

Return

MDA error code