Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Memory helper macros

The GETRAMFREE(), UNLOCKMEM(), and LOCKMEM() macros assist in memory allocation and management.

Note: Brew MP automatic heap management may be able to allocate more memory than the amount reported as free by GETRAMFREE(); therefore, applications should not base decisions on values returned by GETRAMFREE(). The only way to know whether Brew MP can allocate a block of a certain size is to request it using IEnv_Malloc() or MALLOC().

Developers should not use UNLOCKMEM() and LOCKMEM() without clearly understanding all rules associated with handle-based memory.

Note: GETRAMFREE(), UNLOCKMEM(), and LOCKMEM() are defined in AEEStdLib.h and cannot be used in MOD1 applications. IEnv should be used instead.

Required Files
AEEStdLib.h
Class ID(s)
None
Interface ID
None
Location
\platform\system\inc

GETRAMFREE

This function returns information about the amount of heap space that is available on the device. It should be used for debugging and statistics. applications should not base decisions on values returned by GETRAMFREE().

UNLOCKMEM

This function accepts a pointer to a handle of allocated memory, then marks the block as available to be moved in memory.

LOCKMEM

This function accepts a pointer to a handle of allocated memory, then marks the block as unavailable to be moved. This allows the application to resume its use of the block. After an UNLOCKMEM(), LOCKMEM() returns the current address of the block in memory.