Does using heap memory (malloc/new) create a non-deterministic program? : <p>I started developing software for real-time systems a few months ago in C for space applications, and also for microcontrollers with C++. There's a rule of thumb in such systems that <strong>one should never create heap objects</strong> (so no malloc/new), because it makes the program <strong>non-deterministic</strong>. I wasn't able to verify the correctness of this statement when people tell me that. So, <strong><em>Is this a correct statement?</em></strong></p>

<p>The confusion for me is that as far as I know, determinism means that running a program twice will lead to the exact, same execution path. From my understanding this is an issue with multithreaded systems, since running the same program multiple times could have different threads running in different order every time.</p>
