Hi,
running 5.13/05 compiled from source using MSVC 8 on windows 2000. I am compiling this code in MSVC 8
the following code generates seg fault when it exits the PHA_3 subroutine (after printing "this test is now complete", and it doesn't print "exit PHA"). What is going on?
note that when TCLONES is defined 0 there is no seg fault, it prints exited PHA. I tried not deleting the members of bigArr but that was no help.
"
// root includes
#include "TH1I.h"
#include "TClonesArray.h"
#define TCLONES 1
/*
Prototypes
*/
void PHA_3(); // minimum save histograms function
int main(int argc, char **argv) {
PHA_3(); printf("exited PHA\n\n"); return 0;
}
void PHA_3() {
printf("We ahve entered PHS\n\n");
/* Create the data storage */ const short HIST_SIZE = 256; const short NUM_CHAN = 8; char name[10]; char title[30]; short chan;
#if TCLONES
TClonesArray bigArr("TH1I", 8); for (chan=0; chan<NUM_CHAN; chan++) { sprintf_s(name, "bigHist%d",chan); sprintf_s(title, "Testing a big Histogram %d", chan); new(bigArr[chan]) TH1I(name,title,HIST_SIZE,0,HIST_SIZE); } for (chan=0; chan<NUM_CHAN; chan++) { delete bigArr[chan]; printf("\t deleted %d\n\n",chan); }
printf("this test is now complete\n"); return;
"
Thanks for your help,
George
Received on Fri Dec 08 2006 - 20:02:18 MET
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:02 MET