|
|
|
|
|
by twoodfin
1109 days ago
|
|
By definition, everything on the heap got where it is dynamically, so the minimum number of pointers to chase to find it is 1. In contrast, what’s where on the stack can often be (and often must be) known statically by the compiler and accessed directly, even moved entirely out of memory and into a register. (It’s possible to do this with suitably constrained dynamic allocations, but the optimization is much harder.) |
|