arduino's String object fail.

I'm new to Arduino, not new to software or C++.

Just finished a 6 hour debugging session on my arduino + bluetooth + accelerometers + RGB LED project only to find that the root cause of all of my memory corruption was the Arduino built and recommended String object (String() - Arduino Reference). I had a pretty simple use case where I was doing some simple string parsing and concatenation, but that was enough to corrupt enough memory to crash my entire program within milliseconds. In the end, it only took about 20 minutes to re-write the code using standard c++ character array functions (strchr, atoi, etc) and now everything works perfectly.

I know it's kind of a rant, but this type of thing really undermines my trust in arduino as a platform and definitely impacted my ability to create something. At the very least, I'd like to make sure everyone is wary of the String object. And maybe this is the catalyst for a good conversation about why this object is being recommended and what can be done to improve it's memory management.

Cheers.

I hate to break it to you, but Google or a visit here would have saved you about five hours fifty five minutes, and provided pointers to a fix, or a warning-off.

Don't use dynamic memory allocation on a memory-constrained architecture.

Yeah, I was admittedly more concerned and focused on other areas of my application; mainly the ones I considered risky. It wasn't until after I exhausted investigating those areas that I turned to looking at other things like the usage of String objects. Definitely naive of me to assume that an arduino published class was solid. It was a post or two here that eventually led me to the right answer.

Thanks.

I agree that it's quite appalling that the issue has still not even been documented in the reference section. It's bad enough that the underlying bug has been outstanding for so long, but to leave it completely undocumented too is quite extraordinary. People using the published API should not be expected to Google for reasons not to use specific features in the API, and this absurd bug seems to come up on a daily basis.

The gurus on the board told me to stay away from string objects and glad I did. There is a fix though by replace some Malloc file.

If it did work, it sounds like it would take up a lot of memory anyway; something that's a rare commodity on the arduino.