Skip to main content


ec_memtype_register — Register a new memtype with the system


#include "ec_malloc.h"

| int **ec_memtype_register** ( | def); |   |

const mem_type_def * <var class="pdparam">def</var>;


Register a new memtype with the system. The build-in memtypes are enumerated at the section called “Memory Types”.

Given a mem_type_def structure, this function registers the memtype with the allocator and returns the memtype id that can then be passed to calls to ec_malloc and related functions to allocate memory against that type.



A constant pointer to a “ec_mem_type_def” struct.

Return Value

The new memtype id, or MEMTYPE_REGISTER_FAILED (-1) if the new type could not be registered.

Note that the definition structure is effectively copied; after this call returns, the allocator does not use the provided mem_type_def pointer, however, the memtype_description field must not be transient memory; its value is assumed to hold a valid value for the lifetime of the process.


It is legal to call this function in the Scheduler thread.

See Also

Was this page helpful?