Platform Package reference: Function EwReclaimMemory()

Description of the function EwReclaimMemory() available in all Platform Packages for ANSI C compatible target systems. This function is intended to be used when integrating the Embedded Wizard created GUI application with the underlying graphics subsystem, graphics hardware or other external GUI applications coexisting on the same system.


void EwReclaimMemory( void )


The function EwReclaimMemory() activates the garbage collection in order to dispose memory occupied by objects, which are not used anymore. Actually, the garbage collection consists of two phases Mark and Sweep.

In the first phase EwReclaimMemory() distinguishes between live objects and the garbage. This is done by traversing the graph of object relationships. All reached objects will be marked. The traversing starts at the root set. The user can add and remove objects to or from the root set by calling the function EwLockObject() and EwUnlockObject().

In the second phase EwReclaimMemory() deinitializes and frees every object, which has not been marked during the first phase. Similarly, all resources and strings not used anymore are released in the second phase.


DON'T START the garbage collection while the code of the GUI application is actually executed. Call the function EwReclaimMemory() from the main-loop of the GUI application only. Usually always at the end of the main-loop. DON'T START the garbage collection in context of a foreign thread.