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.

How to find out RAM usage in Embedded Electronic Control Unit (ECU) ?

Status
Not open for further replies.

jani12

Member
Please consider some professional embedded system with 16-bit microcontroller.

I know embedded software build tools report program flash memory usage. I think they also report RAM usage but do they report maximum RAM usage?

Build tools may not know how much heap will be used during run-time. Are there other RAM usages that build tools aren't aware of?

How to accurately find out how much RAM is being used during run-time?
 
For a start you need to specify which device you're talking about, as each is likely to be completely different, assuming it's even possible.

From a PIC point of view, it tells you program and data use after compilation, and if it compiles then there doesn't seem to be any memory issues. Obviously if you're doing something stupid (as C allows you to do) then you could easily kill things, but in my experience the compiler seems to reject any memory issues it doesn't like.
 
I avoid Malloc() for this very reason unless I KNOW how it will be used and released plus, it's frequently leaky - better to allocate required buffers as this assumes worst case - all buffers allocated at the same time.
It's impossible to report run time parameters as, by definition, they're undefined. Same as you can't know if a divide by zero may happen in your code at run-time.

Actually, how can a tool possibly know how much RAM you will allocate at run-time? Mind reading?


Mike.
 
I avoid Malloc() for this very reason unless I KNOW how it will be used and released plus, it's frequently leaky - better to allocate required buffers as this assumes worst case - all buffers allocated at the same time.
It's impossible to report run time parameters as, by definition, they're undefined. Same as you can't know if a divide by zero may happen in your code at run-time.

Actually, how can a tool possibly know how much RAM you will allocate at run-time? Mind reading?


Mike.
I don't think XC8 allows Malloc() :D
 
Some interesting discussion about this problem :





Regards, Dana.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top