TFile Write() on own written class gives segmentation fault

Hello dear Rooters,

please help me…

I have an own written class defining a Shower in some experiment. Acutally this framework uses classes based on root.
So I wrote a class EdbShowerP which has (will have) an appropriate descrption of a shower.
This class has an several TObjArrays, TSortedLists, TH1Fs as member variables.
I can acces all member functions and member variables, I can access instances of this class objects by other classes, I can dump them. This all works. (rootcint dictionary of course is also done correctly).
But when I try to open a root file and write the class object to it I get a simple segmentation fault executing the TFile::Write() method.

I am totally stuck up, since I need to write this shower class into files to proceed.
What kind of information you need to help me coping that problem?

Best regards from

I post only a very short code output to give you an overview:

EdbShowerP* show = new EdbShowerP();
// Fill shower here …
show->Print(); // Works fine, every information is printed correctly…
TFile* file2= new TFile(“TESTFILE2.root”,“RECREATE”);
show->Write(); // CRASH HERE

Could you post the shortest possible RUNNING script reproducing the problem?


Dear Rene,
thanks for your quick answer…

Well, this may not be that easy since this depends on classes defined by the “fedra” framework and therefore there is some additional stuff behind it to get it running.
F.e. I am using different class implementations from this framework.
I can post the class implementation I made, here:

I am not sure if this may help you… But maybe…

Personally I guess, something goes wrong because of TObjArray or TSortedList objects, which are created as member objects.

Best regards,
debugtest.C (800 Bytes)
EdbShowerP.h (7.9 KB)
EdbShowerP.cxx (16.4 KB)

As already said, I cannot debug this problem without having the shortest possible RUNNING script reproducing the problem. If you do not succeed in localizing the problem you can always set the output in debug mode to see where it crashes (need a gdb output)

TFile* file2= new TFile("TESTFILE2.root","RECREATE"); gDebug=2; // must #include "TSystem.h" show->Write(); // CRASH HERE


Hello Rene,

it seems that the Streamer crashes when writing a TMatrix, this is the last output I get.


WriteBuffer, class:TMatrixTBase, name=fNelems, fType[5]=6, TStreamerBasicType, bufpos=11786, arr=0x8a83f80, offset=28
WriteBuffer, class:TMatrixTBase, name=fNrowIndex, fType[6]=3, TStreamerBasicType, bufpos=11790, arr=0x8a83f80, offset=32
WriteBuffer, class:TMatrixTBase, name=fTol, fType[7]=8, TStreamerBasicType, bufpos=11794, arr=0x8a83f80, offset=36
WriteBuffer, class:TMatrixT, name=fElements, fType[1]=48, TStreamerBasicPointer, bufpos=11802, arr=0x8a83f80, offset=248

*** Break *** segmentation violation
Attaching to program: /proc/5412/exe, process 5412
[Thread debugging using libthread_db enabled]
[New Thread 0xb6bcd6c0 (LWP 5412)]


I will try to modify buffersize or so…

Best Regards,

Hello again…

Good news, the problem seems to be solved…

The crash appears on root v.5.21/04 8 (developement version)
but it runs correctly under root 5.18 00 (production version)

So, @ Rene and root developers,

unfortunately (due to the new classes) I was not able to reproduce you a running script but this last debugstatement may give you hint what is wrong in this dev-version…

Best regards,

[quote]but this last debugstatement may give you hint what is wrong in this dev-version… [/quote]Well not quite enough. Storing a standalone TMatrixT works just fine and the files you sent to not (at least as far as I can tell) refer to TMatrixT … so I can not see any connection between the output and your code!

Did you mean that you found a solution to make it work with the 5.21 or that you have a work-around by using an older version of ROOT?


Dear Philipe,

thanks for looking at the code.
No unfortunately, yesterday evening I tried this code working on my home machine - a 64bit system - and got stuck at the same position.
In summary I can say (same code of course):

32bit, root 5.18 (trunk@21744), gcc 4.2.4 :working
64bit, root 5.18,(trunk@21744), gcc 4.2.4 :NOT working

So I dont know further…
I will contact the software resonsible for this external class implemetntations first and discuss this issue, maybe its not related to Root after all.
Then I will update here some news.

Up to then,
lots of best regards for helping,