| |
@@ -676,6 +676,14 @@
|
| |
function, check if `malloc` had been called,
|
| |
and free the buffer as needed.
|
| |
|
| |
+ Remember that memory allocated on the stack through `alloca`
|
| |
+ is released at the end of the function and not at the end of
|
| |
+ the block where it is defined, thus it is reccommended to not
|
| |
+ call `alloca` inside a loop. In this regard, VLA behaves better,
|
| |
+ considering the memory allocated with VLA is released at the end
|
| |
+ of the block that defines them. Do not mix VLA and `alloca` though,
|
| |
+ otherwise this behaviour is not guaranteed for VLA either!
|
| |
+
|
| |
[[sect-Defensive_Coding-C-Allocators-Arrays]]
|
| |
=== Array Allocation
|
| |
|
| |