This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to know runtime RAM usage

Goodmorning,

I'm trying to know my MSP430 RAM memory usage in order to check it and find what function or code portion uses it too much. Is there a low level function  to access it on runtime?

Thank you so much in advance,

Seo

  • Well, you can write a function that is called at start of every of your code funtions adn it compares the current stack poitne rto the last time, flagging some signal if it gets a sudden large increase.

    However, chances are rather low that it helps.

    A large unexpected increase on ram at runtime usually has one of three reasons:

    1) usage of large local arrays or a large number of local variables in a funciton
    2) recursions
    3) stack corruption

    The first two should be easy to detect when you go through your code. The third is more difficult to track down. While often being a result of one of the first two (a stack overfow into the global variables or hte heap, where a write to these areas corrupts the stack), it may also be cause bd out-of-bounds array writes. Which are not easy to detect when staring at the code. (thhough it isn't impossible, with some experience)

    perhaps you should describe a bit mroe detailed what problem you have/what you observe. Perhaps you didn't ask the right quesiton for your problem.

**Attention** This is a public forum