A question about how memory is stored (and VLAs)

Let's get this straight.

Variable Length Arrays (VLA) in C live on the stack.

They are variable length in that they can be a different size every time they are declared. Their size is specified by a variable.

They are not dynamic arrays as in dynamically resizeable after they have been created.

Last I heard the Linux guys were busy removing use of VLA's from Linux for memory safety/security reasons and because it turns out they have poor performance.

VLA's are a misfeature introduced into C in C99 and subsequently discouraged in C11, no longer being a requirement for a compiler to implement them.

3 Likes