Re: [ROOT] function can not be compiled

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jun 07 2000 - 08:25:51 MEST


hi Masa,
This is not a CINT bug. It is simply a bookeeping problem between
the ROOT classes TF1, TMethodCall and the CINt class G__CallFunc.
The TF1 constructor when called with a CINT function creates a TMethodCall
object.
In turn the TMethodCall constructor (via the Init function) creates a
G__CallFunc
object. So far, so good. However when a TF1 object is deleted, the TMethodCall
destructor deletes the G__CallFunc object. At the next call to TF1 with the
same interpreted function, CINT returns correctly that the function is unknown.
I could remove the call to the G__CallFunc destructor in TMethodCall destructor.
However, this will generate some memory leakage.
The destructor of G__CallFunc being empty, in principle no damage should happen
when invoking this destructor several times. However, the problem is somewhere
with a non reentrant Init or SetFunc function.

Rene Brun


Masaharu Goto wrote:
> 
> Hello Huaizhang,
> 
> Thank you for reporting a bug.
> 
> I'd like to look into this. For doing so, will you give me complete
> information about your example. In this case, I do not know how 'hist'
> is created. I'd appreicaite if you send me small and complete example.
> 
> Masaharu Goto
> 
> >
> >I wrote the following program.
> >
> >Double_t RatioFunc(Double_t *t, Double_t *par) {
> >  Double_t R;
> >  R=par[0]*cos(2*3.14159265*0.0002291*(1-par[1]*1.0e-6)*t[0]+par[2])+par[3];
> >  return R;
> >}
> >
> >TF1* RatioFit(TH1F* h, Float_t t_start, Float_t t_end) {
> >
> >  TF1 *RatioFit=new TF1("RatioFit", RatioFunc, 0, 700000, 4);
> >
> >  RatioFit->SetParNames("A", "R", "'f#", "offset");
> >  RatioFit->SetRange(t_start, t_end);
> >  RatioFit->SetParameters(0.4, 120, 0, 0);
> >
> >  h->Fit("RatioFit", "R");
> >  return RatioFit;
> >}
> >
> >Then I tried to do
> >
> >int i;
> >TF1* fit;
> >for(i=0; i<5; i++) fit=RatioFit(hist, t, 400000.);
> >
> >After the first fit, which is o.k., it complain "Function:RatioFit cannot be
> >compiled".
> >However, the following program works well.
> >
> >int i;
> >TF* fit;
> >fit=RatioFit(h, t, 40000);
> >for(i=1; i<5; i++) fit=RatioFit(hist, t, 40000);
> >
> >I wonder why those two programs make difference.
> >
> >Huaizhang Deng



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:27 MET