• C

"Dynamic Memory Allocation by 'C' for a target (That does not have any Operating System on it)

In 'C', for dynamic allocation, the Borland Compiler allocates memory on the Heap. I want to know, if i am developing  firmware for a target (AM186ER), which does not have any operating system on it, can i use dynamic allocation for that? If, yes then how heap memory allocation is to be taken care into the Firmware?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Usually in firmwares dynamic memory allocation is not encouraged.
If you still want to do it, then you will have to know the memory layout of your firmware.
Also, you should understand how the processor works and manages memory.

The memory allocation heap is not an OS concept.  malloc(), calloc(), and realloc() are
functions in the standard C library.  When running on systems with a modern OS underneath,
these functions typically allocate large chunks of system memory, then parcel it out in small
bits for individual mallocs().  Embedded systems usually provide some or all of the standard
library functions, including malloc() and free().  The embedded environment may require you
to specify a region of memory on the device to be used as the memory allocation heap, either
as a compiler option or at process initialization time.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Does it has any memory manager? since you said it has no OS I presume you don't. In such a case there is no point in dynamic memory allocation, since you would need some thing to manage the memory (memory manager). check what your firmware support.

for more information visit:

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.