George Sp
George Sp

Reputation: 572

How to see heap dynamicly during execution C++

I made a C++ application and I currently test it for memory leaks.

On g++ 7.2.0 it has no leaks

enter image description here

but on g++ 5.4.0 it does.

enter image description here

I have some classes (dynamic data structures) are initialized and used but this seems to be irrelevant to the leak as it has the same size even when the data structures are way bigger or always empty until the end.

How can I see where these 72,704 bytes are allocated so i can free them?

Any help/ideas are welcome.

I can provide the code if needed.

Upvotes: 1

Views: 248

Answers (1)

Lanting
Lanting

Reputation: 3068

In this specific case, you can't as its a gcc bug that has (as you noticed) been fixed: Valgrind: Memory still reachable with trivial program using <iostream>

Should you actually want to investigate your heap usage, you could use valgrinds heap profiler: massif http://valgrind.org/docs/manual/ms-manual.html

Upvotes: 6

Related Questions