fix: avoid alloacting huge objects on stack
This MR makes a few small changed to avoid allocating huge objects on the stack to reduce total stack size.
Motivation was the use of perf
to profile HLT2.
perf record --call-graph dward,<stack-size>
only lets you specify a max stack-size of 64kB. If the stack is larger than that, perf won't be able to properly unroll the call-chain
But on top this also seems to be better for performance, so it's a win-win
Edited by Christoph Hasse