RE: [ROOT] possible bug in cint?

From: Philippe Canal (pcanal@fnal.gov)
Date: Tue Oct 23 2001 - 16:36:33 MEST


Hi,

The problem seems to be that gcc/linux does like to allocate a huge amount of
memory of the stack.  You have:

struct GammaModule {
  Double_t tc99Count[64][1024];
  Double_t tc99Center[64];
  Double_t co57Count[64][1024];
  Double_t co57Center[64];
  Double_t ebin[64];
  Double_t tc99Energy[64][1024];
};

void calibrateEnergy(){
  GammaModule module[16];
  ....

Each GammaModule is already 1.5Mb.  So you are trying to allocate on
the heap 24Mb!

This cause the gcc/linux system I tried, to core dump the process.

The simple work around is to use:

  GammaModule  *module = new GammaModule[16];

(and add delete module at the end of the function).

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of WSChoong@lbl.gov
Sent: Tuesday, October 23, 2001 2:02 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] possible bug in cint?



  I am using version 3.02.02.  Attached is a C++  file and a data file 
which is read by 
one of the functions.  I ran the file in root using ".x 
calibrateEnergy.C()".   The function 
"readModuleSpectrum" read the data file correctly if the for loop in 
"calibrateEnergy" is 
commented out.  However once the for loop is uncommented,  the condition 
for the 
while loop in "readModuleSpectrum" is always true even though the 
condition is false.


    Woon-Seng Choong



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:03 MET