C++ Program Always Crashes While doing a std::string assign

前端 未结 4 938
半阙折子戏
半阙折子戏 2021-02-05 23:11

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\

4条回答
  •  耶瑟儿~
    2021-02-05 23:40

    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 ;)

提交回复
热议问题