TCanvas::Print causing segmentation violation


I encountered a crash when running the attached macro (MEMd1.C) on lxplus with the latest version of ROOT but I’m not sure about the reason behind.

I have set some breakpoints using cout and noticed the crash occurred when TCanvas::Print is called at line 162. Yet everything works when I use a different definition of the variables to be filled into the histograms (that is to uncomment lines 124 and 134 and comment out 125 and 135).

Please also find the stack trace attached. I would be thankful if anyone could explain what went wrong.

MEMd1.C (5.9 KB)
stacktrace.txt (17.1 KB)


could you try a recent root? You have the instructions here
If the problem persists, could you provide a reproducer we could run?


in addition make sure that none of the branch are containing ‘arrays’. See the output of TTree::Print or TTree::MakeClass on your TTree for a way to check.

I’ve tried switching to different versions (from the latest root to root 5 or some recent but not newest builds) and running on different places (lxplus and my local machines) and the same behaviour happened in all cases…

Some of the TTrees have branches containing vectors but none of those branches are used in the macro. The only ones used contain doubles and floats.

Can you run valgrind on your failing example (valgrind --suppressions=$ROOTSYS/etc/valgrind-root.supp root.exe -b -l -q ....)?

I am having same problem.
Do I just type “valgrind --suppressions=$ROOTSYS/etc/valgrind-root.supp root.exe -b -l -q”?

You, of course, also need to pass the name of the macro to be executed.

As Danilo asked earlier: can you provide a small reproducer we could run ?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.