Go Down

Topic: malloc() bug and SD cards (Read 757 times) previous topic - next topic

solar_eta

Does anybody know if the malloc() bug that causes memory leaks with Strings also affects the SD card libary? There are various references to SD library using malloc().

I'm having a problem with a Uno and Ethernet card which looks like a clasic memory shortage problem. The Arduino is logging the temperatures at various places in a hot watertank, saving the data to an SD card every 10min and acting as a web server so that the data can be pulled off over the ethernet. Every so often the ethernet locks up (ping times out) or it stops writing data to the card.

I have discovered that there is usually 588 bytes of sram free through all but one of the routines that the sketch goes through and this does not reduce in the long term so when the SD libary is invoked there should be enough room for the SD's 512 byte buffer.

I won't post the code because it runs to 28Kbyte at the moment and I'm trying to simplify it.

billroy

If you aren't detecting a long-term leak the next most likely source is a buffer overflow or some other species of wild pointer.

About which it will be difficult to provide help until you post your code.

-br

marco_c

TYhe SD library that comes with Arduino has a memory leak that shows itself when you open/close file repeatedly. I use the SDFat library - faster and no memory leaks.
Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Go Up