1.2k views
in System Integration by
In order to control the memory consumption, the cache for bitmap resources should be limited. How to achieve this?

1 Answer

0 votes
by

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. 
For example:

#ifndef EW_MAX_SURFACE_CACHE_SIZE
  #define EW_MAX_SURFACE_CACHE_SIZE  0x100000
#endif

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.

by
Does the EW framework remove unused bitmaps from the cache?

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...