Re: debugging a seg fault

From: John <idarraga_at_cern.ch>
Date: Thu, 6 Nov 2008 10:52:57 -0500


Hello Roger,

You are probably blowing the stack defining that matrix in that way.

The size you are asking for is ~104554*48*8 bytes = 40 148 736 bytes yep ... too much.

Move your stuff to the heap memory, it means ... allocate your "word" matrix using the "new" operator. If you don't know how to implement it let me know.

John Idarraga
UMontreal

Roger Mason wrote:
> Hi,
>
> I'm testing a program that reads a rootfile and makes histograms from
> a tree. The program fails with a seg fault at the marked line:
>
> const Long64_t nenergies = v1.size();
> #ifdef DEBUG
> cout << "Nenergies = " << nenergies << " at " << "line " << __LINE__ << endl;
> #endif
>
> Int_t word[nenergies][48]; // <---------- SEG FAULT
> #ifdef DEBUG
> cout << "Line = " << __LINE__ << endl;
> #endif
>
> The value of nenergies at that point is 104554, much smaller than the
> maximum size of a Long64_t.
>
> I'd apperciate suggestions on how to debug this further.
>
> Thanks,
> Roger
>
> ROOT 5.20/00 (trunk_at_24524, Oct 01 2008, 15:00:00 on linux)
>
Received on Thu Nov 06 2008 - 16:54:43 CET

This archive was generated by hypermail 2.2.0 : Sun Dec 07 2008 - 17:50:01 CET