Re: writing files to disk, getting <CustomReAlloc2>: passed oldsize 64, should be 393225

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Wed, 13 Dec 2006 18:09:17 +0100


Hi George,

we cannot reproduce this. I get
$ ./camac.exe

         after0
         after1
         after2
         after3
         after4
         after5
         after6
         after7

about to write
chan 0 writing
chan 1 writing
chan 2 writing
chan 3 writing
chan 4 writing
chan 5 writing
chan 6 writing
chan 7 writing
saved all of them
this test is now complete
exited PHA

which I assume is what you'd expect. Are you linking against libNew? Don't. Please send us your complete build log; it might tell us what goes wrong in your case.

Cheers, Axel.

George Locke wrote:
> 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);
> #endif
>
> /*
> 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 Wed Dec 13 2006 - 18:09:32 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:02 MET