Yes, you should.
There should be a corresponding delete
for every new
in your program.
But your program doesn't need dynamic allocation:
Obj obj;
obj.u = i;
obj.v = i + 1;
objList.push_back(obj);
Also, your syntax was wrong - objList.push_back(*Obj); // should be *obj, not *Obj
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…