I've used code like How much static RAM is used - Arduino Forum on the Arduino to tell how much SRAM is remaining. After reusing some code from a sketch I've been using on the Edison on an Arduino, I found a memory leak in it, which I was able to fix. However, I'm wondering if there are any others, and I figured one simple way to tell would be to watch the available memory over time.
Is there a similar approach that works with Arduino sketches on Edison? (neither __brkval nor __bss_end are available on the Edison) Or is there a different way I can get an idea of my memory usage? Maybe something in /proc I could look at after getting my PID?
I know two ways to check the memory usage on Linux by using the free command and with cat /proc/meminfo. If you want to use them in a sketch, you can use the system() function, and then send the output into the serial monitor. You would have to use them like this: