Parsing server data while playing .wav file with Arduino Wave Shield

PaulS:

What would you suggest I do?

Read all the replies - especially #1.

Okay, stupid mistakes... I've tried parsing the data as I receive a complete message:

dc42:
What you need to do is parse the data either as you receive it or whenever you have received a complete message. That way you only need to store the 2 integers in the message, which takes 2 bytes per integer, assuming a 16-bit unsigned range is enough. So 4 bytes per message. If you have 300 of them, that's 1200 bytes, leaving 824 free out of the 2K available on most Arduinos.

Okay, that somewhat works. However, it stops randomly around halfway through the WAV file. I'm using this function to check the RAM usage...

int freeRam(void) {
  extern int  __bss_end; 
  extern int  *__brkval; 
  int free_memory; 
  if((int)__brkval == 0) {
    free_memory = ((int)&free_memory) - ((int)&__bss_end); 
  }
  else {
    free_memory = ((int)&free_memory) - ((int)__brkval); 
  }
  return free_memory; 
}

And I get around "271", so it shouldn't be a memory problem. The WAV file stops playing, but it continue to read data... so am I experiencing a memory problem or what?