J
Jeff
I have a question about potential memory leakage in a 2 dim array I
have.
If I say:
vector< vector<int> > vec;
vec.push_back( vector<int>() ); // initialize the row
vec[0].push_back(1);
vec[0].push_back(2);
vec.pop_back();
This leaves 2 columns of leaked memory, correct? (vals 1 and 2)
Is it correct rather to say:
vec[0].pop_back(); // erase 2
vec[0].pop_back(); // erase 1
vec.pop_back();
My guess would be the latter is correct, however I had some conflicting
results while testing some simliar code and wanted to be sure.
Thanks
have.
If I say:
vector< vector<int> > vec;
vec.push_back( vector<int>() ); // initialize the row
vec[0].push_back(1);
vec[0].push_back(2);
vec.pop_back();
This leaves 2 columns of leaked memory, correct? (vals 1 and 2)
Is it correct rather to say:
vec[0].pop_back(); // erase 2
vec[0].pop_back(); // erase 1
vec.pop_back();
My guess would be the latter is correct, however I had some conflicting
results while testing some simliar code and wanted to be sure.
Thanks