What is taking RAM space?

Status
Not open for further replies.

alphacat

New Member
In my application, the Uc dynamically allocates memory spaces, and then releases them.

After quite time of the Uc's operation, it doesnt manage to allocate reasonable memory spaces - Osal_Mem_Alloc returns NULL.

However, if at that point I power-off and on the Uc, it does manage to allocate the same memory space that it didnt manage to allocate a second before the powering-off.

It seems that something occupies more and more RAM space as the Uc continues running.

What could it be, besides calling Osal_Mem_Alloc without having Osal_Mem_Free following it?

Thank you.
 
Are the RAM spaces all the same size, or are they varied sizes? It's most likely memory fragmentation.
 
The stack takes RAM and grows from the top of memory downward. Dynamically allocating and deallocating RAM space a uC is generally avoided.

EDIT: I should expand on that, it's avoided because of the fragmentation mentioned above. There's no garbage collection routines built in, unless maybe you are using a higher level language like BASIC or something.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…