The total stack space available is 1MB, but each pointer is 8 bytes.
So we have to limit the amount of pointers we allocate on the stack to
somewhere below 128K.
Pick-to: 6.8 6.7 6.5
Change-Id: I1d1262a4048cf4b3fed8df813decc3e142430a32
Reviewed-by: Mate Barany <mate.barany@qt.io>