I have been trying to debug a crash in my application that crashes (i.e. asserts a * glibc detected * free(): invalid pointer: 0x000000000070f0c0 ***) while I\
As you said it's a weird behavior.
To be honnest with i think you are wasting time looking into a possible bug with std::strings. Strings are perfectly safe as long as you are using them well.
Anyway, with the informations you are giving : First, are you using threads ? It's might be a thread problem. Second, you check your program using valgrind. Have you no warnings at all ?
Note : The most critical valgrind's warnings are invalid read and invalid write.
PS : As said in commentary, you should probably use g++ to compile C++ code ;)