Exposing TGraph by name to interpreter

Well, I would try to add:
gROOT->Add(g);
but then, for example, when you try to “gggg->Draw(…);” it, you will get (just once):
Warning in TROOT::Append: Replacing existing TH1: gggg (Potential memory leak).
See also: [url]Drawing TGraph versus TH1F
Well, you might try to be clever and do:
delete g->GetHistogram(); g->SetHistogram(0);
But this won’t help … see also [url]Graph initialized in loop: annoying “memory leak” message
Note that, if you draw it right after you create it (and set its name), you will automatically get it elsewhere afterwards (just like you were going through an “intermediate” file).