1

I had a problem with a memory leak in my sketch and cornered it with MemoryFree.h. This works great and I was able to fix my leak.

My sketch is not really static, but My var sizes are. I observed, that the free memory on the arduino reaches a different values and stays there.

For Example

  1. Run 1: 1655 Bytes Free
  2. Run 2: 1659 Bytes Free
  3. Run 3: 1654 Bytes Free

For every run, I get a different, but over a short time, fixed memory usage. Is this normal?

P.S: The serial input to the script just repeats forever with the exact same data.

1 Answer 1

2

You haven't posted any code, so any answer is guesswork. However ... if your code makes decisions based on external events (eg. readings from sensors) then it may allocate memory differently, and in a different order, each time.

Sometimes memory allocation leaves gaps (known as "heap fragmentation"). Small differences in your results probably show slightly different sized gaps, due to the allocation order.

3
  • Indeed, I added no code, because I wanted an abstract answer. Since it is just an observation, not a real problem. Thanks anyway.
    – moestly
    Commented Apr 13, 2016 at 3:57
  • I see. This site is not supposed to be used to ask questions which are not about real problems. I am pleased I could help, but please ask practical questions in the future, about real problems.
    – Nick Gammon
    Commented Apr 13, 2016 at 6:51
  • Thanks for your reply and any bit of information, you shared with me. I am fully aware of the rules and would categorize this as 'potential real future problem'.
    – moestly
    Commented Apr 14, 2016 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.