Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.
 
What microcontroller? What language/compiler?
 
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.

Latest threads

New Articles From Microcontroller Tips

Back
Top