Memory (RAM) usage indicator

Hi everyone,

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.

Thank you very much in advance for your answers.

The otter.

As far as IAR’s heap is concerned, have a look at this,

static I Sys_Heap ( I idx )
 * 	See,
 *  Also __iar_dmallinfo doc in iar_dmalloc.h
	struct internal_malloc_stat_struct memInfo;
	__iar_internal_malloc_stats( &memInfo );
		"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();
		"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.

Here’s an example of using lv_mem_monitor:

1 Like

Thank you very much ! I implemented your examples and it worked very well.