Platform Package reference: Function EwSetStackBaseAddress()
Description of the function EwSetStackBaseAddress() 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 EwSetStackBaseAddress( void* aStackBaseAddress )
Base address of the CPU stack used by Embedded Wizard application.
The function EwSetStackBaseAddress() remembers the given value aStackBaseAddress as start address of the CPU stack used by Embedded Wizard application. Knowing this the Garbage Collector can be started while the application is executing code and can evaluate stack contents in order to mark Chora objects and strings stored on it actually.
Usually, the garbage collection is performed at the end of a screen update by invoking the function EwReclaimMemory(). Running the garbage collection while the application is actually executing code is problematic because references to Chora objects or strings stored locally on the CPU stack or in CPU registers can't be taken in account. From this arises the problem, that memory reserved for Chora objects or strings remains occupied until the screen update is done. The probability for an out of memory issue increases.
With the introduction of so-called immediate garbage collection this problem is solved. If the application runs in an out of memory problem, the garbage collection can be started immediately. For this purpose, however, the Garbage Collector needs to know the contents of the CPU stack. By invoking the function EwSetStackBaseAddress() at the initialization time of your application you can inform the Garbage Collector about the stack base address.
To use the immediate garbage collection please ensure that the Runtime Environment and Graphics Engine are compiled with the macro EW_USE_IMMEDIATE_GARBAGE_COLLECTION being defined in your make file.