Too big memory consumption by "page" list

Description

com-crop

I need simple list with 2-lines elements, controlled from keyboard. Now use page + [cont + 2 labels]*N.

Memory consumption is 2K per every 5 additional items. That’s too much. Is there any method to reduce?

What MCU/Processor/Board and compiler are you using?

  • Now - PIO+SDL2+Ubuntu
  • Target - stm32f072cbt6 (128k flash + 16k ram)

What do you want to achieve?

Less memory consumption for list

What have you tried so far?

  • Dropped everything. Every list item is just cont, not button
  • No themes. Created 3 global styles and apply those everywhere

Code to reproduce

Open project, change list content as you wish and run sdl2 build. It prints mem stat to console.

Screenshot and/or video

See above.

It’s 2kB for 15 element (1 cont + 2 label) * 5). So 2kB / 15 = 136 byte / object. It seems correct.

I was thinking about implementing a special list which needs

  • item height
  • an array of custom structs (descriptors) e.g. with some texts and icons
  • and a callback to draw an item to a given place based on a given descriptor

This way no objects are created at all and even very long lists could be created very effectively.

However, it’s still just a plan…

2 Likes

Hm… the most problematic list has const strings and all sizes fixed. I could create container only and draw texts manually. Is that possible? If yes, where to read about? 3x mem reduce is enouth for my case.

A minor suggestion: draw at least the containers (or buttons) and add only the texts manually. You can assign the texts as user_data to the containers.

To draw the texts manually you need to overwrite the design function of lv_cont.
Take look at this article.

3 Likes

That’s exactly what i needed. Thanks!

1 Like

hi @puzrin,
How did you implement this list? Can you share it?

Best regard
Lucas

Old post but wondering if this was ever completed?