anilgkts / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

memory leak in SD library - IDE 1.0 #814

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
JGoulder reported:

When a file is opened a malloc() is performed to get memory.  When a file is 
closed the memory is freed. If the file object is destroyed before the file is 
closed, the memory is never freed.

- http://arduino.cc/forum/index.php/topic,91472.0.html -

Existing code:

File::~File(void) {
  //  Serial.print("Deleted file object");
}

JGoulder also proposed a fix:

File::~File(void) {
  close();
  //  Serial.print("Deleted file object");
}

Original issue reported on code.google.com by rob.till...@gmail.com on 12 Feb 2012 at 11:08

GoogleCodeExporter commented 9 years ago
I tested JGoulder's fix didn't help me!
Ok, the memory loss is solved, now I dont get any filenames out.
I am running the "listfiles.ino" from the examples of the SD library.

/Bertil

Original comment by berra.li...@tele2.se on 12 May 2012 at 8:17

GoogleCodeExporter commented 9 years ago
There is no excuse for this bug to still be open. It's a one line fix, and it 
can eat through your memory in no time. The proposed fix to add 'close();' 
works great.

Original comment by walkingd...@gmail.com on 15 Jan 2013 at 6:15

GoogleCodeExporter commented 9 years ago
After having applied the patch, as reported by Bertil, listfiles examples 
doesn't work any more
Discussion is going on on github https://github.com/arduino/Arduino/issues/814

Original comment by f.fiss...@arduino.cc on 15 Oct 2013 at 2:09