Since this is refactoring step to get rid of alloca and simplify things 
I think simply switching to malloc is justified.

To truly improve on the code and keep performance the introduction of SmallArray 
that packs small fixed array and does this logic in ctor/dtor internally is in order.