Is there a way to omit or garbage collect methods in a class that are never actually referenced from the sketch (similar to the way normal C functions are GC'ed)
Actually, this seems to be happening SOME of the time. A serial.print("Hello World") program does not end up including the code for floating point print, but it DOES include Serial.peek Serial.read, and Serial.available, and I can't see what 's different between Serial and Print...
Print writes to a memory buffer in SRAM...
Serial writes to the HW UART FTDI buffer...
u r right, the linker (avr-gcc) should just included the necessary functions...
i will chk it and be right back...
cont'd
hum... it seems like virtual methods r always used (for some address table inherent to each object, iirc), so that the compiler mistakens that use as a "necessary" use (which it is not)...
in order to allow overriding, virtual functions store a pointer to the current version of the implementation. Thus it will make your object in RAM bigger and the compiler seems to be rather conservative when getting rid of them.