Hi all,
I'm using the BOOST libraries to compute an adjacency list and its transitive closure. I'm defining them as follows:
What I'm doing is:
loop start
add edge information to the g_adjacencyList
compute the transitive closure of the adjacency list
loop end
After that I want to compute the total memory consumption in bytes of each of the above data structure.
I'm using the sizeof operator as follows:
The results I get, put me in question that I' doing something wrong.
The bottom line question is that I would like to know if the above method to get the total memory consumption of each data structure in bytes is correct or not.
Thanks in advance.
I'm using the BOOST libraries to compute an adjacency list and its transitive closure. I'm defining them as follows:
Code:
... typedef boost::adjacency_list<> AdjacencyList; AdjacencyList g_transitiveClosure; AdjacencyList g_adjacencyList; ...
loop start
add edge information to the g_adjacencyList
compute the transitive closure of the adjacency list
loop end
After that I want to compute the total memory consumption in bytes of each of the above data structure.
I'm using the sizeof operator as follows:
Code:
boost::graph_traits<AdjacencyList>::vertex_iterator i, end; boost::graph_traits<AdjacencyList>::adjacency_iterator ai, a_end; unsigned int _memAL = sizeof(g_adjacencyList); for (boost::tie(i, end) = vertices(g_adjacencyList); i != end; ++i) { _memAL += sizeof(*i); tie(ai, a_end) = adjacent_vertices(*i, g_adjacencyList); for (; ai != a_end; ++ai) _memAL += sizeof(*ai); } unsigned int _memTC = sizeof(g_transitiveClosure); for (boost::tie(i, end) = vertices(g_transitiveClosure); i != end; ++i) { _memTC += sizeof(*i); tie(ai, a_end) = adjacent_vertices(*i, g_transitiveClosure); for (; ai != a_end; ++ai) _memTC += sizeof(*ai); }
The bottom line question is that I would like to know if the above method to get the total memory consumption of each data structure in bytes is correct or not.
Thanks in advance.
Comment