As an aside, the String class you use in your example can also be problematic since it exposes a heap corruption problem in versions up to 1.0.4 and introduces the risk of heap fragmentation in all versions. In a system with such limited heap space and such limited ability to manage the heap, using dynamic (heap) memory to store dynamic data is not a smart approach. I recommend that you use c-strings (null-terminated char arrays) instead. There are no particular advantages to using the String class and IMO you would be better off forgetting that it exists.
Peter, String has a huge advantages... It prevents a huge amount of frustration.
The function I am working on will generate GCode commands.. I just want to build simple string but I am finding it hard to even just add a char to char *.