D
Diwa
// -----------------------------------
class Column
{
public:
string name;
vector<int> values;
};
// -----------------------------------
void loadValues()
{
Column p = new Column();
p->values.push_back(55); // <--- Line 1
p->values.push_back(66); // <--- Line 2
delete p; // <--- Line 3
}
// -----------------------------------
Are the values inserted (Line 1 and 2) on
the stack or on the heap ?
Is there a memory leak for the two inserted
values inspite of the "delete p" at line 3 ?
Thanks
Diwakar
class Column
{
public:
string name;
vector<int> values;
};
// -----------------------------------
void loadValues()
{
Column p = new Column();
p->values.push_back(55); // <--- Line 1
p->values.push_back(66); // <--- Line 2
delete p; // <--- Line 3
}
// -----------------------------------
Are the values inserted (Line 1 and 2) on
the stack or on the heap ?
Is there a memory leak for the two inserted
values inspite of the "delete p" at line 3 ?
Thanks
Diwakar