# Macro to Add Array to TTree branch crashes

**URL:** <https://root-forum.cern.ch/t/macro-to-add-array-to-ttree-branch-crashes/26047>\
**Category:** ROOT\
**Created:** [August 28, 2017, 2:58pm UTC](https://root-forum.cern.ch/t/macro-to-add-array-to-ttree-branch-crashes/26047 "2017-08-28T14:58:32Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [August 28, 2017, 3:37pm UTC](https://root-forum.cern.ch/t/macro-to-add-array-to-ttree-branch-crashes/26047/4 "2017-08-28T15:37:17Z")

</div>

> [@No error when macro crashes](https://root-forum.cern.ch/t/no-error-when-macro-crashes/14931/2):
>
> Nothing in the “output”, that you show in your post, suggests that your macro “died” in any way. Try to add some “debug” lines, e.g.: std::cout \<\< "Before totalPE" \<\< std::endl \<\< std::flush; Double\_t totalPE[fiberNum][numOfVoxels]; std::cout \<\< "After totalPE" \<\< std::endl \<\< std::flush; There is just one possible problem in the line that you suspect. Your “Double\_t totalPE[768][161616];” is 24MB long. It is possible that this exceeds your stack size “limit”. Try: [bash]$ ulimit -S -a [ba…

> [@Upper limit of entries in one bin and in whole histogram](https://root-forum.cern.ch/t/upper-limit-of-entries-in-one-bin-and-in-whole-histogram/15475/2):
>
> [TH2F](http://root.cern.ch/root/html/TH2.html) bins are [“Float / Single precision floating-point numbers” (4 Bytes = 32 bits)](http://en.wikipedia.org/wiki/Single_precision)[TH2D](http://root.cern.ch/root/html/TH2.html) bins are [“Double precision floating-point numbers” (8 Bytes = 64 bits)](http://en.wikipedia.org/wiki/Double_precision) See also: [Wikipedia - Floating point](http://en.wikipedia.org/wiki/Floating_point) You don’t say how your program crashes, but … If I were you I would start to search for “memory leaks” in the procedure that fills histograms. Try to run your code using valgrind (and carefully study messages that appear in the beginning of the output): valgrind --tool=memcheck --leak-check=full […

> [@Issue 3D histogram](https://root-forum.cern.ch/t/issue-3d-histogram/16012/4):
>
> In general, the operating system imposes some “user limits”. Try: [bash]$ ulimit -S -a [bash]$ ulimit -H -a [tcsh]$ limit [tcsh]$ limit -h If any application, while running, exceeds any of these limits, it will be killed (note also, on a i686 32-bit system, the address space is 4 GB; no such problem on a x86\_64 64-bit system, as long as you have enough RAM plus “swap space” available).

---

_[View the full topic](https://root-forum.cern.ch/t/macro-to-add-array-to-ttree-branch-crashes/26047)._
