I was wondering if there is any indicator or way to monitor precisely the RAM usage of a screen or an application. It would be very helpful to me to know what percentage of LV_MEM_SIZE is used for instance.
I am currently running littlevgl on STM32R9I-Discovery board and using IAR Workbench.
As far as IAR’s heap is concerned, have a look at this,
static I Sys_Heap ( I idx )
{
/*
* See,
* https://www.iar.com/support/resources/articles/mastering-stack-and-heap-for-system-reliability/
* https://www.iar.com/support/tech-notes/general/iar-dlib-library-heap-usage-statistics/
* Also __iar_dmallinfo doc in iar_dmalloc.h
*
*/
struct internal_malloc_stat_struct memInfo;
__iar_internal_malloc_stats( &memInfo );
TRACE_INF(
"Malloc Heap\n"
" Size : %6u B, %5u W\n"
" Max availalbe : %6u B, %5u W\n"
"Current in use : %6u B, %5u W\n"
, memInfo.fp, memInfo.fp/4
, memInfo.maxfp, memInfo.maxfp/4
, memInfo.used, memInfo.used/4
);
struct mallinfo mInfo = __iar_dlmallinfo();
TRACE_INF(
"non-mmapped space allocated from system, arena : %6u\n"
" number of free chunks, ordblocks : %6u\n"
" space in mmapped regions, hblkhnd : %6u\n"
" maximum total allocated space, usmblks : %6u\n"
" total allocated space, uordblks : %6u\n"
" total free space, fordblks : %6u\n"
" releasable (via malloc_trim) space, keepcost : %6u\n"
, mInfo.arena
, mInfo.ordblks
, mInfo.hblkhd
, mInfo.usmblks
, mInfo.uordblks
, mInfo.fordblks
, mInfo.keepcost
);
return 0;
}
I do not think it is in the docs, but have a look at this app from the examples repo.
you can call lv_mem_monitor to find out what the lv heap memory status is.