Failed invoking <symbol>, Stack Overflow Error - a method with many local variables

Hello, I have a looong draw method in my Weathergraph app and I got to a point, where adding a single more variable (like var xyz = 1;) causes the following error on all devices, just as they run a said method:

Failed invoking <symbol>
Stack Overflow Error

Is this a known limit? Is it documented somewhere? Are there known workarounds?

I had an idea of moving these variables from method to module or global scope, would that help? Thanks!