Re: using fscanf within root ...

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue Feb 10 1998 - 19:29:03 MET


Hi Masa,

  concerning the ifstream dtor problem. I made the following fix in
libstrm.cxx and now it works fine in ROOT:

static void* operator new(size_t size,void* p) {
  if((long)p==G__getgvp() && G__PVOID!=G__getgvp()) return(p);
#ifdef G__ROOT
  return ::operator new(size);
#else
  return(malloc(size));
#endif
}

The problem is that you override new but not delete. In the ROOT case
your new is called which calls malloc. However when the object is
deleted the ::operator delete() is called which is the ROOT version.
This version checks for some special leading size byte and this byte
is not there (since allocated via malloc). Calling global new (which
is actually the ROOT new) the size byte is correctly set.

Cheers, Fons.


Masaharu Goto wrote:
> 
> Denis,
> 
> Concented about ifstream destruction problem,
> 
>  The only platform I can use now is Linux, Windows-NT and 95. Below is
>  a table of results,
> 
>                     ROOT/CINT      standalone CINT
>     Linux               x               o
>     Windows-NT          o               o
>     Windows-95          o               o
> 
>  Because standalone CINT works fine with your macro, I guess ROOT's
>  libNew.so has something to do with this.  I imagine this can be
>  simply fixed when Fons is back.
> 
>  Masaharu Goto
> 
> >              hi Masaharu,
> >    Do you try the macro on other platforms?
> >    Does it works on AIX 4.1 for example ?
> >                                              Denis

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:30 MET