-1
내가 작업 ... pair
개체에 대한 을 메모리를 할당하려고 그리고 이런 식으로 삭제하고 있습니다 :메모리 누수가
#include <iostream>
#include <utility>
int
main(int argc, char **argv)
{
std::pair <int, int> *m_pair= new std::pair<int, int>(1, 10);
std::cout << "First : " << m_pair->first
<< " Second : " << m_pair->second << std::endl;
delete m_pair;
return 0;
}
그러나 Valgrind의이 불평 다른 무엇 메모리 누수 ... 입니다 나는 자유해야합니까?
Valgrind output is
==14145== HEAP SUMMARY:
==14145== in use at exit: 72,704 bytes in 1 blocks
==14145== total heap usage: 2 allocs, 1 frees, 72,712 bytes allocated
==14145==
==14145== LEAK SUMMARY:
==14145== definitely lost: 0 bytes in 0 blocks
==14145== indirectly lost: 0 bytes in 0 blocks
==14145== possibly lost: 0 bytes in 0 blocks
==14145== still reachable: 72,704 bytes in 1 blocks
==14145== suppressed: 0 bytes in 0 blocks
==14145== Rerun with --leak-check=full to see details of leaked memory
call_init.part 것은
메모리 누출이 없습니다. valgrind 결과는 무엇입니까? –
@EliSadoff 질문 업데이트 됨 ... – Goutam
여기에 메모리 누수가 없습니다. 당신은 분명히, 간접적으로, 아마도 0 바이트를 잃어 버렸을 것입니다. –