Do I need to manually delete pointers of objects that already Drawn on a TCanvas after I call TCanvas::Clear()? e.g.:
TCanvas*c = new TCanvas();
TGraph* g = new TGraph();
TMarker* m = new Marker(1,1,22);
g->Draw();
m->Draw();
c->Clear();
//Do I need to do this?
//delete g;
//delete m;
When you create a graphics object, it exists independently. Drawing it does not transfer its ownership to the canvas/pad. You need to delete it if you want to free the associated memory.
So would it probably be better to use unique-ptrs instead?
auto c = std:::make_unique<TCanvas>();
auto g = std:::make_unique<TGraph>();
auto m = std:::make_unique<TMarker>(1,1,22);
g->Draw();
m->Draw();
c->Clear();