小编cub*_*271的帖子

valgrind&C++:从字符缓冲区构建std :: string

简单的C++/valgrind问题我希望有人可以提供帮助.

当针对以下代码运行valgrind时,我得到两个与std :: string相关的可能泄漏:

==10325== 17 bytes in 1 blocks are possibly lost in loss record 1 of 2
==10325==    at 0x402569A: operator new(unsigned int) (vg_replace_malloc.c:255)
==10325==    by 0x40CFD05: std::string::_Rep::_S_create(unsigned int, unsigned int, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.13)
==10325==    by 0x40D0B10: ??? (in /usr/lib/libstdc++.so.6.0.13)
==10325==    by 0x40D0CF5: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.13)
==10325==    by 0x804872B: main (test.cc:9)
==10325== 
==10325== 17 bytes in 1 blocks are possibly lost in loss record 2 of 2
==10325==    at 0x402569A: operator …
Run Code Online (Sandbox Code Playgroud)

c++ valgrind

2
推荐指数
2
解决办法
2640
查看次数

标签 统计

c++ ×1

valgrind ×1