# Root quits when reading a root file full of thousands of data

**URL:** <https://root-forum.cern.ch/t/root-quits-when-reading-a-root-file-full-of-thousands-of-data/42021>\
**Category:** Newbie\
**Created:** [October 27, 2020, 2:41am UTC](https://root-forum.cern.ch/t/root-quits-when-reading-a-root-file-full-of-thousands-of-data/42021 "2020-10-27T02:41:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cepheides](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/bcef8e/32.png) [@Cepheides](https://root-forum.cern.ch/u/Cepheides)\
**Post date:** [October 27, 2020, 2:41am UTC](https://root-forum.cern.ch/t/root-quits-when-reading-a-root-file-full-of-thousands-of-data/42021/1 "2020-10-27T02:41:49Z")

</div>

Hi all,

[HEP\_Project\_ProgramV4.C](https://root-forum.cern.ch/uploads/short-url/7Bzen68OsvFQkvTiSN6bIwF0RdS.C) (16.8 KB)  
Here is the link to `data.root` file in the code: [https://www.dropbox.com/s/ovg8264j2fdn65e/data.root?dl=0](https://www.dropbox.com/s/ovg8264j2fdn65e/data.root?dl=0)

I am attempting to read in all the data from this root file and analyze, but whenever I run `main()`, quits on me without any errors. Here is the C file and the root file to reproduce the situation. Is there a memory issue at play here or another cause?  
_ROOT Version:_ 6.22  
_Platform:_ Ubuntu 18.04  
_Compiler:_ Not Provided

* * *

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [October 27, 2020, 8:43pm UTC](https://root-forum.cern.ch/t/root-quits-when-reading-a-root-file-full-of-thousands-of-data/42021/2 "2020-10-27T20:43:13Z")

</div>

Hello Cepheides,

Yes, it seems that both `NMuon` and `NElectron` on line 67 have not been initialized. Therefore, the size of the arrays `Muon_Charge` and `Electron_Charge` (declared on line 71), whose space is allocated on the stack, is undefined (and possibly large).

Cheers,  
J.

---

<div class="post-metadata">

**Author:** ![Cepheides](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/bcef8e/32.png) [@Cepheides](https://root-forum.cern.ch/u/Cepheides)\
**Post date:** [October 29, 2020, 1:46am UTC](https://root-forum.cern.ch/t/root-quits-when-reading-a-root-file-full-of-thousands-of-data/42021/3 "2020-10-29T01:46:24Z")

</div>

Hi there,

I went ahead and grabbed the numbers for NElectron and NMuon manually from the tree and initialized them. Yet, the same is still happening.[HEP\_Project\_ProgramV4.C](https://root-forum.cern.ch/uploads/short-url/cNLtbJrfHYLsQdiLsYFzN8K7FTf.C) (16.9 KB)

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [October 29, 2020, 12:55pm UTC](https://root-forum.cern.ch/t/root-quits-when-reading-a-root-file-full-of-thousands-of-data/42021/4 "2020-10-29T12:55:11Z")

</div>

It seems that you might be still corrupting your stack. You can try compiling your macro to a binary executable and try running it through `gdb` to get some insights.

We cannot reproduce it because we lack the ROOT file that you are using.

---

<div class="post-metadata">

**Author:** ![Cepheides](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/bcef8e/32.png) [@Cepheides](https://root-forum.cern.ch/u/Cepheides)\
**Post date:** [October 29, 2020, 2:26pm UTC](https://root-forum.cern.ch/t/root-quits-when-reading-a-root-file-full-of-thousands-of-data/42021/5 "2020-10-29T14:26:46Z")

</div>

Hi, are you unable to view the root file in the Dropbox in my first message?
