RE: [ROOT] compiled/interpreted class inheritance

From: Philippe Canal (pcanal@fnal.gov)
Date: Tue Apr 01 2003 - 21:07:40 MEST


Hi,

One of the major limitation is that the virtual methods are sometime not
handled (which often includes the destructors).
When inheriting from TObject (which has a lots of virtual functions,
including some that should be overloaded (via adding a ClassDef)), I would
recommend always compiling your code (which is easy, just  use ACliC by
adding a '+g' at the end of your script name).

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Rene Brun
Sent: Tuesday, April 01, 2003 3:29 AM
To: Michael Alan Mazur
Cc: roottalk@pcroot.cern.ch
Subject: Re: [ROOT] compiled/interpreted class inheritance


Hi Michael,

I have some difficulty understanding your problem.
Could you provide a simple exampl?

Rene Brun

Michael Alan Mazur wrote:
>
> hi all,
>
> i'm running root 3.02.07 (also tried 3.03.05) on RHL7.2... i have a class
> representing a particle which inherits from TObject, and i run my code in
> CINT. i always get (and usually ignore) the warning:
>
> "!!!There are some limitations regarding compiled/interpreted class
> inheritance"
>
> is one of these known limitations that creating a TIter to iterate over a
> TList of these objects causes memory problems?
>
> i have a TList containing my particle class, *leptonList, and i have two
> TH1* hpe and hpmu. these objects have all been created, and the pointers
> point to valid memory locations at the start of this code.
>
> in my main loop, i have the following code, which creates a TIter and
> dumps all the pointers for debugging:
>
> cout << "    before creating TIter " << (void*)hpmu <<" "<<
>   (void*)hpe << endl;
> cout << "    before, leptonList =  " << (void*)leptonList << endl;
> TIter iterLep(leptonList);
> cout << "    after  creating TIter " << (void*)hpmu <<" "<<
>   (void*)hpe << endl;
> cout << "    after,  leptonList =  " << (void*)leptonList << endl;
> cout << "    &iterLep =            " << (void*)&iterLep << endl;
>
> and, when i run this, i get the output below... the first time through the
> loop is okay, but the second time through, creating the TIter changes the
> pointers to the list itself and to two TH1 objects which have no
> connection to the TList or the interpreted class at all... it then crashes
> when i try to access one of the corrupt TH1 pointers.
>
> is this something people have seen before? any suggestions on what to do
> in this case?
>
> thanks,
> -michael
>
> root [3] t.Loop("test.root",10)
> beginning event 0
>   examining B+ 1 of 2
>     before creating TIter 0x91f4160 0x91e7850
>     before, leptonList =  0x9129ac0
>     after  creating TIter 0x91f4160 0x91e7850
>     after,  leptonList =  0x9129ac0
>     &iterLep =            0x8f85e48
>   examining B+ 2 of 2
>     before creating TIter 0x91f4160 0x91e7850
>     before, leptonList =  0x9129ac0
>     after  creating TIter 0x22 0x87eecf8
>     after,  leptonList =  0x4050fae4
>     &iterLep =            0x8d58df0
>
>  *** Break *** segmentation violation
> Root > Function Loop() busy flag cleared



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET