alloc-rule-of-thumb
Rule of thumb
If the size is known at compile time and lifetime is bound to the function’s execution → keep it on the stack.
If size is unknown until runtime or needs to survive after the function returns → allocate on the heap.