The RAM size of the Sparki is 2.5 Kbytes meaning it’s not a lot to work on. It seems that the Sparki driver itself consumes 2 Kbytes of that so you are left with 512 bytes or so for your sketch. In my experience if you get below 100 bytes or so weird things will start happening, I guess it’s because the stack may be corrupted at this point. So in reality you have close to 400 bytes, which I think is to little. I would like to see an optimized driver that consumes less RAM and where you could easily remove resources in the driver when you compile by utilizing pre-compiler definitions, like #define SPARKI_USE_DISPLAY if you would like the to use the display and the memory resources it utilized, if not these memory resources would be available for the sketch instead.
Edit: Seems like pre-compiler definitions might be tricky given Arduinos structure, maybe a better solution would be to have a standalone include for the RAM heavy parts of the driver like the display (which seems to consume the majority of the 2 Kbytes of RAM) so it can be included exclusively by #include instead? What do you think Joe?
Call the following function to find out how much RAM you have left (taken from playground.arduino.cc/Code/AvailableMemory):
int freeRam () {
extern int __heap_start, *__brkval;
int v;
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}