Do not use alloca inside a loop #21
1 changed files with 2 additions and 1 deletions
|
@ -681,7 +681,8 @@ 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.
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue