Location of surface and font caches in memory

asked Jul 4, 2017 in System Integration by Robert

In the documentation I could not find where the surface and font caches are actually allocated.
Are they allocated within the memory pool that is created during intialization of the memory manager?
Can you also explain for what other purposes the memory pool is used?

Kind regards,

commented Jul 4, 2017 by Robert

In our case we use a STM32F7 board with a capacitive touch screen (800x480 pixels) and 16 MByte of external SDRAM. 8 Mbyte of external SDRAM is setup to be used by Embedded Wizard and the other 8 MByte is reserved for usage by our application.

We have the defined the following #defines for configuration:

NOTE: Most of them we've derived from our experiments with the STM32F769-Discovery board.

This results in a memory pool of approx. 5 MB (8 MB minus 2 times frame buffer).

1 Answer

0 votes
answered Jul 4, 2017 by Manfred Schweyer

Hi Robert,

the font cache (more precise the glyph cache) is a preallocated piece of memory that is used to store all uncompressed glyphs within the memory - this means, all glyphs that are requested during runtime in order to draw a text are decompressed and stored within the glyph cache. As long as there is enough space within the glyph cache, all frequently used glyphs are kept within the cache to avoid decompression again and again.

The glyph cache is allocated by the memory manager - in case of STM32 it will be allocated somewhere in the provided memory pool. The size of the glyph cache can be configured by setting the defines EW_MAX_GLYPH_SURFACE_WIDTH and EW_MAX_GLYPH_SURFACE_HEIGHT.

The surface cache is not a preallocated memory - the define EW_MAX_SURFACE_CACHE_SIZE is used to control the number of bytes that can be occupied by bitmap resources that are no more used by the UI application. As long as there is enough memory available, the bitmap resources are still available within the memory in order to avoid further loading and decompression in case they are used again. Just a kind of runtime optimization.

The size of the surface cache can be configured by setting EW_MAX_SURFACE_CACHE_SIZE within your makefile. You can set it to a small value like 100 kByte in order to ensure that small images remain in the memory and only large bitmaps are removed immedialtey if they are no more in use.

The provided memory pool is used for all resources (images, font glyphs, strings) and for all Chora objects. By using the memory profiling feature you can print the memory consumption at runtime.

Best regards,


Embedded Wizard Website | Privacy Policy | Imprint