"corrupted double-linked list" error

Hi Experts,
Im running a code with a header file that I’ve written for it. When I run the code, it runs which I understand from the cout statements, but right before I write the histogram into the root file it crashes.

The error that is displayed is :
* Error in `root': corrupted double-linked list: 0x0ee6e360 *

I am attaching the code, header file and a small .root file here:

PtCorr_mix.C (5.7 KB)
PtCorr_mix.h (4.3 KB)
Momentum_AOD.root (114.6 KB)

Any help on fixing this error would be greatly appreciated!!!

I run the code as such:

.L PtCorr_mix.C
PtCorr_mix t

Hi @Rutik,

This error seems to come from the C/C++ runtime library, more specifically it might come from the memory management routines. In general, that means that your program is corrupting the state of something.

After taking a look at your code, here are some general comments:

  • In PtCorr_mix.C, line 55, GetEntriesFast() will only work if the tree has been loaded, which is not at that point. Anyways, the value of nentries does not seem to be used except for printing it, so you may remove.
  • You are declaring somewhat big arrays in the stack (see lines 86-93), which might be problematic.
  • Unjustified use of goto in line 199, where a loop could have been used.

The code is not very readable so I cannot provide any insights on where the actual problem is; however, there seems that you might have out-of-bounds accesses to arrays in lines 193-196.


Hi @jalopezg

Thank you for looking into my code.

  • So, I’m loading the tree in my header file, hence it should be okay to GetEntriesFast() right? I was using that method to read my trees faster but the code was crashing, hence I reverted to the normal method of GetEntries().

  • The arrays are really big, but even if I make them smaller, the problem persists.

  • I need the goto command since my variable countmix would not be set by a for loop command, although I’d really appreciate any alternatives.

I’m sorry about the code looking basically like a Frankeinstein, I would also like to mention that I have noticed when I read a list of trees this issue persists, but if I read a single file it does not happen. I feel its a working directory error but I still can’t seem to figure out the issue.


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