Stack Usage v8.4 vs v9.5

So, I just updated a project (FreeRTOS-based) from v8.4 to v9.5 (and also learned that v10 is a thing already :sweat_smile: ), and what surprised me the most was the increased Stack usage in our project.

With v8.x the allocated stack in a debug build was 4kB. This was enough with a good amount of slack when compiled for production. However, with v9.5, I had to increase the stack size to 8kB, with water making hovering around 7.6kB.

I know that a good amount of time has passed since the release of v9.x, but could anyone provide some insights on what is causing this major stack usage increase?

Is there any use case that from v8.x to v9. x that could result in extra stack usage? To be more specific, in the stack requirements for calling lv_timer_handler

Hi @Gildons,

I recommend you start checking:

  • Objects/ widgets styles
  • Make sure you are handling correctly with all animations
  • And check if you have a memory leak when you create dynamic objects.

Each project needs special attention to detail, but it’s good practice to separate UI implementation and FW/Low Level to make sure everything is all right.

Obrigado sr!

You mentioned styles. Are there any changes to styles that you are aware of that would result in increased stack usage?

Well, a common problem is multiple initialization, this can be a problem.
But, it’s just a guess, I have no clue how you develop your project. Indeed, the v8.5 compared to v9.5 defines a change in feelings

I see your point, but multiple initialization, for example, without a matching uninit would affect the heap, not the stack, and here I’m asking about the stack usage increase in the thread calling lv_timer_handler

Yeah, you are right about that. Could you share the lv_config.h file?

Sure.

lv_conf.h (53.4 KB)

Any ideas here? One possible culprit I’m looking at is lv_obj_update_layout → layout_update_core that is reentrant, but that was already present on v8.4.

Are there other operations that weren’t reentrant on v8.4 but are in v9.5?

Sorry for pinging you directly @kisvegabor! I have been a little out of the loop, and I’m not sure who would be the best person to ping on this, but it would be really helpful if you could shine some light on this.

I know that specifics will be difficult, but from an overall library evolution, I would like to understand what could be the driver for the higher stack usage from v8.4 to v9.5, and what I could change to mitigate this stack increase.

Thanks!