Skip to content

Why one allocation is nearly free and the other is not

Allocating a local array inside a function is dramatically cheaper than allocating the same array on the heap.

Why?