我在放置新的标准库字符串时面临内存泄漏。
下面我给出了泄漏显示的代码。
string string1("new string");
char _string[sizeof(string)];
new(_string) string(string1);
使用dbx发现泄漏,如下图
Actual leaks report (actual leaks: 1 total size: 52 bytes)
Total Num of Leaked Allocation call stack
Size Blocks Block
Address
========== ====== =========== =======================================
52 1 0x43f68 operator new < std::basic_string<char,std::char_traits<char>,std::allocator<char> >::__getRep < std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string < main
Possible leaks report (possible leaks: 0 total size: 0 bytes)
这是真正的内存泄漏还是 dbx 将其解释为泄漏?