API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

IHEAP

Brew Release
Brew MP 1.0.2
See Also
AEECLSID_HEAP GETRAMFREE() FREE() MALLOC() REALLOC() STRDUP()
Description

The use of the IHeap interface is discouraged in new code, with the exception of the IHEAP_GetModuleMemStats() method. Every other method of IHeap either duplicates functionality that is available elsewhere, or is otherwise discouraged:
- IHEAP_CheckAvail(): Use is strongly discouraged. See method's Comments section.
- IHEAP_Free(): It is suggested that you use FREE() instead.
- IHEAP_GetMemStats(): It is suggested that you use GETRAMFREE() instead. Note that
the IHEAP_GetMemStats() return value can be synthesized from GETRAMFREE() by subtracting free space from total space. - IHEAP_Malloc(): It is suggested that you use MALLOC() instead.
- IHEAP_MallocRec(): It is suggested that you use MALLOCREC() instead.
- IHEAP_Realloc(): It is suggested that you use REALLOC() instead.
- IHEAP_StrDup(): It is suggested that you use STRDUP() instead.

The IHeap interface is documented here for backward compatibility.
The IHeap Interface includes functions for allocating and freeing memory, and for obtaining information about the amount of device memory that is available and in use. For simple memory allocation tasks, use the MALLOC() and FREE() macros that are defined in the file AEEStdLib.h.
IHEAP_CheckAvail() checks whether there is enough memory available to allocate a block of a specified size. IHEAP_GetMemStats() returns the amount (the number of bytes) of memory in the system that is currently in use. You can use ISHELL_GetDeviceInfo() to obtain the total amount of memory.
IHEAP_Malloc() allocates a block of memory of a specified size and returns a pointer to it. IHEAP_MallocRec() takes as input a data type; it allocates enough memory for a single instance of this data type and returns a pointer to the memory allocated (the pointer is cast to the specified type). IHEAP_Realloc() changes the size of an allocated memory block. IHEAP_StrDup() makes a copy of a character string and returns a pointer to the memory allocated to hold the copy. IHEAP_Free() frees the memory blocks allocated by these functions.
Usage
The IHeap interface is primarily used by developers who want to query the usage of the memory heap -- how much space is consumed, how much space is consumed by a particular module, and so forth. It also provides an alternative interface to the memory allocation helper functions: MALLOC(), FREE(), REALLOC(), STRDUP().