Streaming Library with NewSoftSerial - Memory issues

Hi,
I am using the streaming library with NewSoftSerial - code below. The micro is a 328P. This somehow causes the demise of my available memory.

#ifndef ARDUINO_STREAMING
#define ARDUINO_STREAMING

#include <WProgram.h>

#define STREAMING_LIBRARY_VERSION 4

// Generic template
template<class T> 
inline Print &operator <<(Print &stream, T arg) 
{ stream.print(arg); return stream; }

struct _BASED 
{ 
  long val; 
  int base;
  _BASED(long v, int b): val(v), base(b) 
  {}
};

#define _HEX(a)     _BASED(a, HEX)
#define _DEC(a)     _BASED(a, DEC)
#define _OCT(a)     _BASED(a, OCT)
#define _BIN(a)     _BASED(a, BIN)
#define _BYTE(a)    _BASED(a, BYTE)

// Specialization for class _BASED
// Thanks to Arduino forum user Ben Combee who suggested this 
// clever technique to allow for expressions like
//   Serial << _HEX(a);

inline Print &operator <<(Print &obj, const _BASED &arg)
{ obj.print(arg.val, arg.base); return obj; } 

#if ARDUINO >= 18
// Specialization for class _FLOAT
// Thanks to Michael Margolis for suggesting a way
// to accommodate Arduino 0018's floating point precision
// feature like this:
//   Serial << _FLOAT(gps_latitude, 6); // 6 digits of precision

struct _FLOAT
{
  float val;
  int digits;
  _FLOAT(double v, int d): val(v), digits(d)
  {}
};

inline Print &operator <<(Print &obj, const _FLOAT &arg)
{ obj.print(arg.val, arg.digits); return obj; }
#endif

// Specialization for enum _EndLineCode
// Thanks to Arduino forum user Paul V. who suggested this
// clever technique to allow for expressions like
//   Serial << "Hello!" << endl;

enum _EndLineCode { endl };

inline Print &operator <<(Print &obj, _EndLineCode arg) 
{ obj.println(); return obj; }

#endif

I call it all over my code to do debug printing. Like this -

// initialized else where like this
NewSoftSerial dbP = NewSoftSerial(0, dbpPin);
LCD.begin(9600);


// called like this
dbP << "PID - " << endl;
dbP << "\t Ki - " << config.Ki << endl;
dbP << "\t Kp - " << config.Kp << endl;
dbP << "\t Kd - " << config.Kd << endl;
dbP << "\t Window - " << _DEC(WindowSize) << endl;

Does this store anything in RAM and if so how do I get rid of it?

All quoted strings will be stored in RAM, so "\t Window - " will use 12 bytes of RAM (don't forget the string terminator). If you have lots of strings you will use up your RAM quickly.

To fix this you either need to remove the strings or move them to flash. To do this check out the flash library (Flash | Arduiniana)