C

Memory optimization

You can reduce flash and RAM footprints by using one or more of the following optimization features or techniques:

Enabling resource compression

PNG compression

You can store an image with PNG compression by setting ImageFiles.MCU.resourceCompression. The image will be decompressed into the cache when needed. This reduces the size of the binary but adds decompression overhead. See ImageFiles.MCU.resourceCompression for more information about using PNG compression in Qt Quick Ultralite applications.

RLE compression

Unlike images that use ImageFiles.MCU.resourceCompression, RLE images with RGB888RLE, XRGB8888RLE, and ARGB888RLE pixel format, are decoded at runtime. This reduces memory usage considerably, but it does not support transforming (scale, rotate, shear, and perspective) such images.

See Lossless compressed image formats for more information.

Framebuffer size

You can optimize the framebuffer size by choosing lower color-depth and/or single buffering. See Framebuffer Requirements for detailed information about the framebuffer size requirements.

You can also improve performance using the hardware layers if your platform supports it. See Improving performance using hardware layers for more information.

Font quality

The font.quality property allows more fine-grained optimization, by providing hints to render low-quality glyphs. You can set the font quality in QML to Font.QualityVeryLow, which saves memory consumed by those glyphs. See MCU.Config.defaultFontQuality for more information.

Omitting source language strings from translations

In some use cases, the source language strings of translations are not rendered at all. Especially when using ID-based translations, the application is not expected to display the source strings. Use the TranslationFiles.MCU.omitSourceLanguage QmlProject property to exclude the source strings from your application binary.

Remove unused glyphs from the font file

When using the Monotype Spark font engine with fontmap font files, it is possible to reduce the size of the font file using Monotype's FontmapEditor utility, which is shipped with Qt Quick Ultralite. This utility allows you to specify a unicode range for a font entry, and remove unused glyphs. This is useful when the subset of glyphs needed by the application is known ahead of time. Especially in the case of CJK font files, removing unused glyphs can result in significant size savings.

Refer to the documentation in the FontmapEditor for more details on how to use this feature.

Note: This feature is available in FontmapEditor version 3.1.1.

Reduce the application stack size

Based on profiling, the Qt for MCUs examples and demos do not use more than 11 kB of stack memory. The default stack size chosen is 24 kB to be on the safe side. By benchmarking the application and checking the value of QulPerf::maxStackUsage, some memory might be saved by reducing the stack size accordingly.

This optimization only applies to platforms where a fixed stack size is set in the linker script, or on FreeRTOS where the Qt Quick Ultralite thread stack size can be configured: Thread stack size

Available under certain Qt licenses.
Find out more.