Skip to main content

Name

ec_memtype_register — Register a new memtype with the system

Synopsis

#include "ec_malloc.h"

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

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

Description

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.

Parameters

def

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.

Threading

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

See Also

Was this page helpful?