On Lady Ada's site, there is a recommendation for her Wave Shield and GPS Shield libraries to hack your individual copy of a standard Serial library file (I think it's wiring_serial.c), to edit the size of the serial receive buffer.
The recommendation is, if you need RAM and use little PC->AVR traffic, to reduce the buffer from:
#define RX_BUFFER_SIZE 128
to a lower positive number:
#define RX_BUFFER_SIZE [glow]16[/glow]
I would recommend the standard header offer this choice without having to edit the header directly.
[glow]#ifndef RX_BUFFER_SIZE[/glow] #define RX_BUFFER_SIZE 128 [glow]#endif[/glow]
Then a user could override the default big buffer in their sketch:
#define RX_BUFFER_SIZE 16 #include <Serial.h>
This would let you build different sketches with different serial buffer sizes easily, since the Arduino IDE is compiling the "library" multiple times anyway.
The only problem with this scheme is that the Arduino sketch IDE kind of hides this by not actually requiring an #include for the standard stuff like the Serial class.