[Resolved] Random Error Codes

Just occurred to me, i forgot to mention im hitting reset on errors there. Which may of given the "out of memory" idea as i know it recalls setup when out of memory. I'll still check out memory issues but any other ideas?

So ive added a Serial.print of free memory just before the file open call 525 is what its sitting on:

...waiting for lock...
525
2012/11/01/15_25_53.csv
error: Cannot Open File
SD errorCode: 0X4

That occurs now or:

...waiting for lock...
Can't access SD card. Do not reformat.
SD errorCode: 0XF

then sometimes it just works:

...waiting for lock...
Invalid Age
525
2012/11/01/15_28_12.csv
201,5x.x,-2.x,2012-11-1 15:28:12,86.10,142.86,0.83

I used:

int freeRam () {
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
}