# No error when macro crashes

**URL:** <https://root-forum.cern.ch/t/no-error-when-macro-crashes/14931>\
**Category:** ROOT\
**Created:** [September 13, 2012, 7:48pm UTC](https://root-forum.cern.ch/t/no-error-when-macro-crashes/14931 "2012-09-13T19:48:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![reben](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/87869e/32.png) [@reben](https://root-forum.cern.ch/u/reben)\
**Post date:** [September 13, 2012, 7:48pm UTC](https://root-forum.cern.ch/t/no-error-when-macro-crashes/14931/1 "2012-09-13T19:48:36Z")

</div>

Hi,

I’m writing a macro that uses a 2D array. But the program just stops when declaring the array. There’s no error or seg fault message. This is how I start the macro:

root -q ‘analysis/particleIDAnl/findLightSpread.C++(,,size)’

Here’s the relevant code:

[code]  
// headers

void findLightSpread(const char\* infile, const char\* outfile, const int size) {

…

const int fiberNum = 768;  
const int numOfVoxels = size_size_size;

Double\_t totalPE[fiberNum][numOfVoxels];

for(int i=0;i\<numOfVoxels;i++)  
for(int j=0; j\<fiberNum;j++)  
totalPE[i][j] = 0;

…  
}[/code]

The macro stops at the line: Double\_t totalPE[fiberNum][numOfVoxels];

Here’s the output. The warnings are due to the header files:

[quote]-bash-3.2$ root -q 'analysis/particleIDAnl/findLightSpread.C++(“scibathMC/output/Ialpha\_1.root”,“analysis/particleIDAnl/spreadFun1.root”,16)'  
Loading SciBath Root Utilities  
include path: -I/usr/local/share/cern/root/5.27.02/include -I/nfs/festus/home/lorebeni/ScibathCode/scibathAnl/install/include  
root [0]  
Processing analysis/particleIDAnl/findLightSpread.C++(“scibathMC/output/Ialpha\_1.root”,“analysis/particleIDAnl/spreadFun1.root”,16)…  
Info in TUnixSystem::ACLiC: creating shared library /nfs/festus/home/lorebeni/ScibathCode/scibathAnl/./analysis/particleIDAnl/findLightSpread\_C.so  
/nfs/festus/home/lorebeni/ScibathCode/scibathAnl/install/include/SBHitInformation.h:40: warning: unused parameter ‘i’  
/nfs/festus/home/lorebeni/ScibathCode/scibathAnl/install/include/SBClasses.h:55: warning: unused parameter ‘i’  
-bash-3.2$  
[/quote]

There’s supposed to be an output file, but that file is not created, so I know the program is stopping at that line. What would cause this?

reben

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [September 13, 2012, 8:07pm UTC](https://root-forum.cern.ch/t/no-error-when-macro-crashes/14931/2 "2012-09-13T20:07:10Z")

</div>

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][16_16_16];” is 24MB long.  
It is possible that this exceeds your stack size “limit”. Try:  
[bash]$ ulimit -S -a  
[bash]$ ulimit -H -a  
[tcsh]$ limit  
[tcsh]$ limit -h  
If this is the case, try (note: your new “soft limit” cannot be higher than the “hard limit”):  
[bash]$ ulimit -S -s 32768  
[tcsh]$ limit stacksize 32768  
and then try to run your “root -q …” command again.
