Stack overflow caused by incrementing global variable (LVGL display)

I have a very large (2500 lines) lvgl based weather display project in the works. The code works fine when running in the host emulator. When running on an ESP32-S3 I unfortunately get a stack overflow.

The following bit of yaml is what is “causing” this:

        - lambda: |-
            id(arrayindex)=0;
        - while:
            condition:
              lambda: return id(arrayindex)<30;
            then:
              # - lvgl.canvas.draw_line:
              #     id: wind_stick
              #     color: LIGHTGREEN
              #     width: 1
              #     points:
              #       - x: !lambda return 90 + (90 * (cos((id(hist_dir)[id(arrayindex)]-90)*PI/180)));
              #         y: !lambda return 90 + (90 * (sin((id(hist_dir)[id(arrayindex)]-90)*PI/180)));
              #       - x: !lambda return 90 + ((90-(70*id(hist_wind)[id(arrayindex)]/id(maxwind))) * (cos((id(hist_dir)[id(arrayindex)]-90)*PI/180)));
              #         y: !lambda return 90 + ((90-(70*id(hist_wind)[id(arrayindex)]/id(maxwind))) * (sin((id(hist_dir)[id(arrayindex)]-90)*PI/180)));
              - lambda: id(arrayindex)++;

Note the commented code is not in play, the stack overflow happens when just this is added:

        - while:
            condition:
              lambda: return id(arrayindex)<30;
            then:
              - lambda: id(arrayindex)++;

Have I just run into yet more memory limitations - or is there something else I am missing? Again - works fine on the host: platform.

EDIT: possibly memory? Reducing the number of loops to 10 instead of 30 stops the stack overflow… Opinions please?

Smells like that one way or another.
Anyway, add the quotes here:

lambda: 'return id(arrayindex)<30;'

No dice. I also tried with repeat: count: 30 and the same thing happened. Reducing the number of readings displayed to 10 means that it doesn’t fail immediately. Removing a bunch of sensors AND leaving the count at 10 makes it perfectly stable but no better than my existing 3.5" weather display…

Would I be right in saying LVGL is more memory hungry than simply coding a display in lambda?

Anyhow I’ll proceed on the “lack of memory” theory and do yet more optimisation…

Quite likely.
Any psram on board?

Yes and supposedly configured correctly according to other forum users who have this board/display combo…