Minimum ram memory usage v6 v7 v8 v9

Hi,

Years ago I used V6 and had no problems fitting a small GUI into 16KB LV_MEM_SIZE with plenty of space left over (it used about 10kb max out of the 16kb). Thought I’d try out V9 and I’m guessing I won’t be able to migrate it to V9 using the same 16KB LV_MEM_SIZE ? I tried the simulator with blank projects, and the memory for a BLANK screen project seems to have drastically jumped 700% from V6 to V9!!! And approx 225% from V7 to V9.

The commits below are from https://github.com /lvgl/lv_port_pc_visual_studio
and the only changes I made are LV_MEM_SIZE (16*1024U) and remove the demo so it can compile and just open a blank screen, no other changes.

6.1.0 - commit 06343f1
used: 1588 ( 10 %), frag: 0 %, biggest free: 14796

7.1.0 - commit 71bba10
used: 5032 ( 31 %), frag: 1 %, max used: 5072, biggest free: 11304

7.9.1 - commit bef60a1
used: 5144 ( 32 %), frag: 1 %, max used: 5160, biggest free: 11216

8.3.9 - commit 3c0a66c
used: 9056 ( 56 %), frag: 0 %, max used: 4452, biggest free: 7328

9.1.1 - commit e6c4dd2
used: 11744 ( 88 %), frag: 0 %, max used: 11744, biggest free: 1744

Few questions:

  1. Is this normal and approx the lowest it can get for a blank V9 project, or are there more things that could be turned off?
  2. I could get away with using V7, but I was really hoping to go to V9, what’s causing V9 to be double V7 for a blank screen?
  3. Does it have anything to do with the Windows VS simulator, will it be different on hardware or is the simulator lv_mem_monitor() 100% accurate of what LV_MEM_SIZE usage would be on the target hardware? ie are the windows drivers for mouse etc… using any of this heap memory? Or not related? My target hardware doesn’t have a mouse.
  4. The doco on the Introduction page for V9 states >2KB heap. Is this a typo? How come mine is using 11.7KB for a blank screen?
4 Likes

I wanted to switch from 8 to 9 and ran into similar issues. Maybe you are interested in that discussion:

Thanks, I did see that but it doesn’t really give me any solutions for shrinking or saving memory usage, unless I missed it?
Did you get to the bottom of why mem monitor total_size doesn’t actually match the size of the memory allocated? It keeps on fluctuating. Why?

Hello,

I only have experience with V8 and V9 so I cannot answer most of these questions.

However,

From my limited experience, I’d say the Windows simulator for LVGL V9.1 on Windows 11 for some reason uses or at least allocates a lot more RAM than what is used on hardware. I use the code::blocks simulator but the results seem to match somewhat. I also use the on-screen perf. monitor instead of the log.
My hardware is a Renesas RA6M3G MCU.

I copied your example- just one empty screen.

lv_obj_t* screen = lv_obj_create(NULL);
lv_screen_load(screen);

LVGL Windows Simulator

  • 10.3KB used ← this is very strange!
  • 10.8KB max

Hardware

  • 3,9KB used
  • 4.2KB max

I have also tested a rather complicated non-empty screen with different widgets, images, labels, and buttons:

LVGL Windows Simulator

  • 22.8KB used
  • 34.9KB max ← why???

Hardware

  • 11.6KB used
  • 12.0KB max

I had expected the LVGL Windows simulator to add some sort of “minimum amount used” so so it would always be about (10.3KB - 3.9KB = 6.4KB) more than hardware, but this does not seem to be the case either.
The only other difference between my two versions is that I have turned off everything that I don’t use in lv_conf.h for the hardware version: ex. LV_USE_CANVAS 0 , etc.
However, this should not make a difference in the amount of memory LVGL allocates for its objects.
Very strange, this also somewhat answers this question:

You might try turning some things off. Who knows?

Now, that still does not explain why V6.1.0 in your testing has much lower RAM usage than V9.1.1.Perhaps it’s because I have the on-screen performance monitor enabled,or RAM usage really did get much worse in between versions.

EDIT:
One other change I neglected to mention, is that I use LVGL V9.1.1 on the Windows Simulator, but apparently not on my hardware- which uses V9-dev.

It could be that some critical errors with RAM usage has been fixed in between V9.1.1 and my slightly more up-to-date development version- you could either try using that (by cloning the github repo) or wait for V9.2.0 to come out, which should not be too long.

Hope this helps, please let me know if you device to try the “dev” version and if it makes any difference.

EDIT 2:

Based on Klaus’ response, it is now pretty clear why LVGL V9 takes up considerably more memory than V8.
See the changelog for LVGL V9 lvgl/docs/CHANGELOG.rst at release/v9.0 · lvgl/lvgl · GitHub
In v9 `lv_color_t` is always RGB888 regardless of `LV_COLOR_DEPTH` !!
What a ridiculous change, this means that projects that previously used 16-bit colors may now use much more memory.

No, there was no solution. I linked to the other thread just to let you know that it got some attention, kisvegabor investigated it, and the conclusion was that it cannot be changed. We have to live with that.
See also this discussion

Good question, didn’t find the reason.

Overall a little bit unsatisfactory, that’s the reason why until now I stayed at version 8.x.

1 Like