There is a PDF reference which includes more information:3. Avoid heap memory allocation.
In the first line, what is meant by "after initialization"? I'm guessing that it is not referring to literal initalization such as "int foo = 10;"? My guess is that if I determine that I need 20MB of memory to do work, I can allocate that when the program starts, but I should not later realloc any additional memory? The reference to "after initialization" seems vague, so I'm guessing it is something speific the expected audience would know.Rule 3: Do not use dynamic memory allocation after initialization.
Rationale : This rule appears in most coding guidelines for safety-critical software. The reason is simple: Memory
allocators, such as malloc, and garbage collectors often have unpredictable behavior that can significantly impact
performance.
A notable class of coding errors also stems from the mishandling of memory allocation and free routines: forgetting to free
memory or continuing to use memory after it was freed, attempting to allocate more memory than physically available,
overstepping boundaries on allocated memory, and so on. Forcing all applications to live within a fixed, preallocated area
of memory can eliminate many of these problems and make it easier to verify memory use.
Note that the only way to dynamically claim memory in the absence of memory allocation from the heap is to use stack
memory. In the absence of recursion, an upper bound on the use of stack memory can be derived statically, thus making
it possible to prove that an application will always live within its resource bounds.
Next issue. In the last paragraph, where it mentions to use stack memory, how is this considered safe? It is my understanding that stack memory is easy to overflow. I've never perceived functions to query available stack memory to make sure it is safe to use. I also believe other programs may use memory in the stack, so this recommendation seems particularly unsafe, and therefor a strange given that the JPL included this in their standard.
My presumption is that there is a minimum level of experience for those statements to make sense, and that I most certainly lack that amount of experience :).
Thanks.



