Strange conflict between SdFat.write() and Serial.print()

It's a very big program to log sensor data running on a mega2560. I've got an SD card and a DS3234 on the SPI bus.
The pertinent bit of code is:

void Logger_SD::saveSample(char * sample_arr,uint8_t sample_len){
  Serial.print("got array ["); Serial.print(sample_arr); Serial.println("]");
  _sample_file.open(_sample_file_name,(O_WRITE | O_APPEND | O_CREAT)); 
  Serial.print(_sample_file_name) ; Serial.println(" opened for writing.");
  _sample_file.write(sample_arr,sample_len);_sample_file.write(13); _sample_file.write(10);
  _sample_file.close();
  Serial.print(_sample_file_name) ; Serial.print(" closed after writing string of size ");
  Serial.println(sample_len);
}

I'm using William Greiman's SdFat library GitHub - greiman/SdFat: Arduino FAT16/FAT32 exFAT Library which was the first SD library I could get to play nice with my DS3234 SPI RTC.

So an examples of this output are:

got array [2014/09/12 16:12:45,-139,-137,124,-248,904,16844,-51,27,-81,332.1,4.414]
SCHED1.CSV opened for writing.
SCHED1.CSV closed after writing string of size 71


got array [2014/09/12 16:12:10,-175,-118,151,-320,864,16888,-53,23,-77,336.5,4.414]
SCHED1.CSV opened                                                                       osed after writing string of size 71

got array [2014/09/12 16:12:46,4909,2134,36,24,28,11,6,8,12,13]
SCHED2.CSV opened                                                                &iMY?closed after writing string of size 51

got array [2014/09/12 16:15:59,4909,2133,40,31,31,11,8,8,13,14]
SCHED2.CSV opened                                                               €rMY?closed after writing string of size 51

got array [2014/09/12 16:29:07,3755,3783,3793,3803]
SCHED3.CSV opened                           ?¹
SCHED3.CSV closed after writing string of size 39

I picked out the failures, it works about 50% of the time.
Those gaps might have some nulls in them as they were hard to copy and paste.

It looks like some sort of memory corruption perhaps. I'm using the freeMemory library and it's reporting values of around 2700 bytes

I'm not sure if this will make a difference, but you can try to put your strings in the flash memory with F().

Example:

Serial.print(F("got array [")); Serial.print(sample_arr); Serial.println(F("]"));

It could be SRAM overflow.

Are you using interrupts? Are you getting callbacks from the SD library? Does it
use intrrupts?

Without the whole sketch there's not much to go on...

Interrupts is an interesting idea. I'm not using interrupts that I know of. I don't think that SdFat uses interrupts either.

I'll throw in a noInterrupts() and see if anything happens.

Unfortunately the sketch is thousands of lines and spans many many files and libraries. It would be impractical to post it all.

In addition to using all the Mega's UARTs and the two SPI devices, I've also got some I2C devices. Everything is polled, so I don't think I need any interrupt capabilities.

MarkT:
Are you using interrupts? Are you getting callbacks from the SD library? Does it
use interrupts?

Without the whole sketch there's not much to go on...