Tag Archives: Memory Management

Contributed Article: Best Practices – Memory Management in C and C++

C and C++ programmers very often allocate and de-allocate memory on the heap without the proper understanding on how these low-level facilities work and what happens underneath. But these memory related problems becomes a great concern in the systems with shortage of almost all the resources including memory, like embedded real-time systems. This dynamic behavior tends to be non-deterministic and the failure is hard to contain. Similarly memory allocation failure on such systems can be fatal. Unlike a desktop application, most embedded systems do not have the opportunity to pop up a dialog and discuss options with the user. Often, resetting is the only option, which is unattractive. This technical paper attempts to discuss the strategies to achieve clean code and appropriate memory management.

Continue reading