Memory Management

Posted

in

by

The memory is limited. And since it is limited it becomes a precious resource. So you have to manage the memory from the beginning of the embedded system.

Most of the code written for embedded system will be in c or in c++ using an IDE. The code will then built by the compiler in the IDE. Compiler will take your code and translate the code into the machine language or the language which your system understands.

Compilers does a decent amount of memory management. But they have limitations. As the size and complexity of your code increase the struggle of the compiler to manage the memory also increase.

So knowing about memory optimization’s from the beginning is good.

In a very basic memory managed model of programming, never make your complete code execute from the main() function. Instead call the sub-functions from the main() and allocate memory at the beginning and do the data processing. After the data processing save the elements in their corresponding memory locations. Deallocate the memory when the data processing is over and return the main function.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *