[Interest] How to prevent large qml forms from hitting javascript stack size?

Ulf Hermann ulf.hermann at qt.io
Mon Sep 11 09:22:47 CEST 2023


> In essence: when a form has a large amount of subforms and Components, 
> then, in the internals of qml engine, it is parsed and every piece of it 
> is assigned totalObjectCount which is accumulated recursively for big 
> forms. Then, in qjsengine sources this happens:
> 
> sharedState->allJavaScriptObjects = 
> scope.alloc(compilationUnit->totalObjectCount());

This form has got to be extremely unwieldy. May I ask what 
totalObjectCount we're talking about?

I recommend splitting the respective component (aka QML file) into 
smaller pieces. QML components are easily nested. You will give yourself 
a much easier time reading the code, too.

best regards,
Ulf Hermann


More information about the Interest mailing list