All bitmap resources and internal surfaces are allocated within the surface cache of the Graphics Engine. As long as there is enough space within the surface cache, all loaded bitmap resources remain within this cache, in order to avoid future reloading and decompressing of bitmaps from the flash memory.
This article describes how to limit the size of the surface cache.
By default, the cache size is 8 MByte! The surface cache size is defined by the macro EW_MAX_SURFACE_CACHE_SIZE. The value of the macro determines the desired cache size in bytes. It is declared within the file ewgfxdefs.h - please do not modify this file!
In order to change the cache size, it is sufficient to set the define within your makefile and to rebuild your project.
Alternatively, the macro can be defined in your 'ewextgfx.h' file.
#define EW_MAX_SURFACE_CACHE_SIZE 0x100000
In this example the cache size is set to 1 MB.
In order to reduce this cache to a minimum, you can set it to 0. In this case, all bitmap resources are removed from RAM immediately after usage.
Don't forget to recompile your project after appending the macro definition. Also please note, that the cache exists for performance reasons. The reduction of the cache size may thus affect the performance of your GUI application. In particular the slow decompression of images will be repeated more frequently if the cache is too small.