Re: root crashes, cint works?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jun 01 1998 - 09:51:44 MEST


Stefan,
Very likely your problem will go away if you do not specify
the parameter -lNew in the link sequence when building alljetsroot.
It couild be that there is a clash between the expectations
of CLHEP for memory allocation and the new/delete redefined
operators in the libNew.so Root library.

Rene Brun

stefan kluth wrote:
> 
> Hi,
> 
> I have an application consisting of the CLHEP 3- and 4-vectors, the CLHEP
> lists and iterators and my own class which is based on these. I can
> produce a custom application with cint (via makecint) which works ok. When
> I create a custom application with root (via rootcint) I get root crashing
> in "operator delete. Here are two (edited) example sessions, where I have
> narrowed down the problem to creating and deleting a Hep3Vector object:
> 
> custom cint:
> 
> [online04] ~/scratch > alljetscint
> 
> cint : C/C++ interpreter
>    Copyright(c) : 1991~1996 [hp] Hewlett-Packard-Japan
>    Author       : Masaharu Goto (gotom@jpn.hp.com)
>    Copyright(c) : 1995~1998 Masaharu Goto (MXJ02154@niftyserve.or.jp)
>    revision     : 5.13.51, May 1 1998 by M.Goto
> 
> alljetscint> .class
> List of all classes
> file            line
> (C++ compiled)          Hep3Vector
> (C++ compiled)          HepLorentzVector public:Hep3Vector
> (C++ compiled)          HepAListBase
> (C++ compiled)          Jet
> (C++ compiled)          HepConstAList<HepLorentzVector> public:HepAListBase
> (C++ compiled)          AllJets
> (C++ compiled)          HepConstAList<Jet> public:HepAListBase
> 
> alljetscint> .T
> Trace mode on 1
> alljetscint> Hep3Vector* v1= new Hep3Vector(1,1,1);
> {Hep3Vector* v v1= new Hep3Vector(1,1,1);
> !!!Calling constructor 0x0.Hep3Vector for new Hep3Vector;
> 2    }
> alljetscint> delete v1;
> {delete v1;
> !!!Calling destructor 0x1400b5220.~Hep3Vector() for v1;
> 2    }
> alljetscint>
> 
> Everything works fine.
> 
> And here is the same with a custom root:
> 
> [online04] ~/scratch > alljetsroot
>   *******************************************
>   *                                         *
>   *        W E L C O M E  to  R O O T       *
>   *                                         *
>   *   Version   2.00/07       19 May 1998   *
>   *                                         *
>   *  You are welcome to visit our Web site  *
>   *          http://root.cern.ch            *
>   *                                         *
>   *******************************************
> 
> CINT/ROOT C/C++ Interpreter version 5.13.55, May 16 1998
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] .class
> List of all classes
> file            line
> ------ tons os root classes -----------
> (C++ compiled)          HepAListBase
> (C++ compiled)          Hep3Vector
> (C++ compiled)          HepLorentzVector public:Hep3Vector
> (C++ compiled)          Jet
> (C++ compiled)          HepConstAList<HepLorentzVector> public:HepAListBase
> (C++ compiled)          AllJets
> (C++ compiled)          HepConstAList<Jet> public:HepAListBase
> root [1] .T
> Trace mode on 1
> root [2] Hep3Vector* v1= new Hep3Vector(1,1,1);
> {Hep3Vector* v v1= new Hep3Vector(1,1,1);
> !!!Calling constructor 0x0.Hep3Vector for new Hep3Vector;
> 2    }
> root [3] .g
> ----- lots of root stuff -------
> 0x140795c60 Hep3Vector* v1=0x140795c40
> root [4] delete v1;
> {delete v1;
> !!!Calling destructor 0x140795c40.~Hep3Vector() for v1Fatal in <operator
> delete>: storage area overwritten
> aborting
> IOT trap (core dumped)
> 
> I work on OSF1 online04.lbl.gov V4.0 386 alpha, a DEC unix 4 system with
> the DEC cxx 6 compiler.
> 
> Any ideas? cheers, Stefan
> 
> ---Stefan Kluth---------------Lynen Fellow----------------|\--|\-------
> -  LBNL, MS 50A 2160       -  phone:  +1 510 495 2376  -  |/  |/      -
> -  1 Cyclotron Rd.         -  fax:    +1 510 495 2957  -  |\/\|\/\|'  -
> ---Berkeley, CA94720, USA-----e-mail: SKluth@lbl.gov------|/\/|/\/|----



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