Hi,
running 5.13/05 compiled from source using MSVC 8 on windows 2000. I am compiling this code in MSVC 8.
I'm getting some errors that are contingent on the instantiation of a class.
here's the error
<CustomReAlloc2>: passed oldsize 64, should be 393225 Fatal in <CustomReAlloc2>: unreasonable size (393225) aborting
The code follows. If the "CRASH_ME" line executes, then the code crashes at the first Write() command (after printing "chan 0 writing"). The code will execute if you comment out the writing part, or if you comment out the crash me line, but together they cause problems...
here's the code
"
// root includes
#include "TH1I.h"
#include "TFile.h"
#include "TClonesArray.h"
// class headers
#include "Camac1.h"
#define CRASH_ME 1
#define NUMCHAN 8
/*
Prototypes
*/
void PHA(short nADC, short nLAM, int nPoints, char histoName[]); //
minimum save histograms function
int main(int argc, char **argv) {
short nADC = 5;
short nLAM = 5;
int nPoints = 20;
char histoName[] = "test histograms";
PHA(nADC,nLAM,nPoints,histoName);
printf("exited PHA\n\n");
return 0;
}
void PHA(short nADC, short nLAM, int nPoints, char histoName[]) {
// Set constants
const int HIST_SIZE = 256;
/*
Create Histograms
*/
TClonesArray spectra("TH1I", 8);
int chan;
char name[50];
char title[50];
for (chan=0; chan<NUMCHAN; chan++) {
sprintf_s(name, "%s %d",histoName, chan);
sprintf_s(title, "%s %d",histoName, chan);
new(spectra[chan]) TH1I(name,title,HIST_SIZE,0,HIST_SIZE);
printf("\t after%d\n",chan);
}
/*
Connect To CAMAC
*/
short int crate = 1; // crate number
char devname[] = "kpa00"; // refers to the camac interface PCI card
#if CRASH_ME
Camac1 * Camac0 = new Camac1(devname,crate);
/*
save histograms
*/
printf("about to write\n");
TFile * save = new TFile("C:/temp/test2.root","recreate");
for (chan=0; chan<NUMCHAN; chan++) {
printf("chan %d writing\n", chan);
spectra[chan]->Write();
}
printf("saved all of them\n");
save->Close();
printf("this test is now complete\n");
return;
"
here is Camac1.h
"
class Camac1 {
public:
Camac1() {}
Camac1(char *devname, short int crate) { }
~Camac1() {}
private:
};
"
thanks again!
Regards,
George
Received on Tue Dec 12 2006 - 17:06:45 MET
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:02 MET