|
From: Evan C. <eva...@gm...> - 2008-10-09 16:22:29
|
suppose:
1. vector < vector <int> > op_sequence;
2. op_sequence = vector < vector <int> >(600, vector <int>(POP, 0));
3. fill (op_sequence[100].begin(), op_sequence[100].end(), 1);
valgrind-3.3.1 reports (valgrind -v --db-attach=yes --tool=memcheck
--leak-check=full --leak-resolution=high --show-reachable=yes
--num-callers=12 ):
still reachable: 1,363 bytes in 40 blocks
7 blocks are due to #3 and the rest don't pertain.
prior to issuing the valgrind command I set:
export GLIBCPP_FORCE_NEW=1
export GLIBCXX_FORCE_NEW=1
as specified in the valgrind FAQ.
Looking for the standard deallocation technique.
I have tried the following but it did not eliminate the reachable mem:
for (i=0; i<600; i++) {
op_sequence[i].erase (op_sequence[i].begin(), op_sequence[i].end());
op_sequence[i].clear ();
}
op_sequence.erase (op_sequence.begin(), op_sequence.end());
op_sequence.clear();
thanks for the feedback,
-e.
|