Once you want to keep data you need to think about memory use
Free memory
#include <MemoryFree.h> void setup() { Serial.begin(115200); Serial.print("freeMemory()="); Serial.println(freeMemory()); }
Now you can see free memory, what can you do
Reduced buffers
Free up some of the serial buffer - http://www.ladyada.net/library/arduino/hacks.html
Don't use strings !