我有一個問題有關的std :: string可能的內存泄漏的valgrind許多警告,像這樣的:C++的std :: string池,調試版本?的std :: string和Valgrind的問題
120 bytes in 4 blocks are possibly lost in loss record 4,192 of 4,687
at 0x4A06819: operator new(unsigned long) (vg_replace_malloc.c:230)
by 0x383B89B8B0: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.8)
by 0x383B89C3B4: (within /usr/lib64/libstdc++.so.6.0.8)
by 0x383B89C4A9: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.8)
我想知道:
- 做std :: string(GCC 4.1.2)使用任何內存池?
- 如果是這樣,是否有任何方法來禁用池(以調試版本等形式)?
不,不退出()。那麼,爲什麼如果沒有游泳池,內存可能會丟失? – 2010-06-08 12:08:22