I’m a embedded GUI developer, I try to apply the LVGL for new project as require from custom should use LVGL.
Before using the LVGL I worked with TouchGFX where I can create 100+ of screens and don’t worries the memory increase cause the memory usage is the maximum memory of one of all screen.
Back to current situation that project has multiple screens (20+) and there are limit of RAM I can not keep all screen, but If delete old screen when load new I face the problem with memory fragmentation.
Is there the way on LVGL configuration that when load to new screen it’s will override to old screen memory(RAM)?
STDLIB WRAPPER SETTINGS
*=========================*/
/* Possible values
* - LV_STDLIB_BUILTIN: LVGL's built in implementation
* - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc
* - LV_STDLIB_MICROPYTHON: MicroPython implementation
* - LV_STDLIB_RTTHREAD: RT-Thread implementation
* - LV_STDLIB_CUSTOM: Implement the functions externally
*/
#define LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN
#define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN
#define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN
#define LV_STDINT_INCLUDE <stdint.h>
#define LV_STDDEF_INCLUDE <stddef.h>
#define LV_STDBOOL_INCLUDE <stdbool.h>
#define LV_INTTYPES_INCLUDE <inttypes.h>
#define LV_LIMITS_INCLUDE <limits.h>
#define LV_STDARG_INCLUDE <stdarg.h>
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/
#define LV_MEM_SIZE (96 * 1024U) /*[bytes]*/
/*Size of the memory expand for `lv_malloc()` in bytes*/
#define LV_MEM_POOL_EXPAND_SIZE 0
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
#define LV_MEM_ADR 0 /*0: unused*/
/*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/
#if LV_MEM_ADR == 0
#undef LV_MEM_POOL_INCLUDE
#undef LV_MEM_POOL_ALLOC
#endif
#endif /*LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN*/
I start with newest version v9.5.0. I would like to find the possible solution 100% avoid memory fragment, Is there the configuration on lv_config.h should help?
I mean 100% on galaxy not exist. But LVGL have from version X own memory management. For best results your code must create right steps. LVGL not control your job.
Little example in conf and RAM reserve LVGL heap. In code start with create primary main screen never deleted, then create startup load screen if differ and show it … After unload delete it … On point you load main static screen … reserved memory revert to unfragment state IF all is ok…