std::string operator+() memory leak?

前端 未结 3 1996
南笙
南笙 2021-02-13 16:03

I\'m quite worry because I wrote a little application and it seems that there is a memory leak if I believe valgrind (What I actually do):

==9321== 251 bytes in          


        
3条回答
  •  星月不相逢
    2021-02-13 16:19

    To quote Valgrind FAQ

    With GCC 2.91, 2.95, 3.0 and 3.1, compile all source using the STL with -D__USE_MALLOC. Beware! This was removed from GCC starting with version 3.3.

    With GCC 3.2.2 and later, you should export the environment variable GLIBCPP_FORCE_NEW before running your program.

    With GCC 3.4 and later, that variable has changed name to GLIBCXX_FORCE_NEW.

    Also discussed in GCC FAQ

提交回复
热议问题