How can I find out how much memory an instance of a C++ class consumes?
- by Shadow
Hi,
I am developing a Graph-class, based on boost-graph-library.
A Graph-object contains a boost-graph, so to say an adjacency_list, and a map.
When monitoring the total memory usage of my program, it consumes quite a lot (checked with pmap).
Now, I would like to know, how much of the memory is exactly consumed by a filled object of this Graph-class? With filled I mean when the adjacency_list is full of vertices and edges.
I found out, that using sizeof() doesn't bring me far. Using valgrind is also not an alternative as there is quite some memory allocation done previously and this makes the usage of valgrind impractical for this purpose. I'm also not interested in what other parts of the program cost in memory, I want to focus on one single object.
Thank you.