tristandnv |
02-12-2013 04:02 AM |
free(): invalid next size(fast) // malloc(): memory corruption - ROOT CERN
Hello dear all,
I'm a Physicist and I come here for help from Programmers as you with much more knowledge and experience...
I wrote a program that finds all the hits and identifies those which overlap from data taken with an oscilloscope. In event::reduce() (event class corresponds to one file-profile and has members as vector<hit>, noise, threshold, etc, where hit is another class corresponding to a single pulse - I can attach the scripts under request) I identify the superpositions, each hit has a label member which sorts them out (same group number means pulses overlapping). Then, in analysis.cxx, the code below, I reduce all the hits. I fit the pulses overlapping and create two event branches, one with the original info (hits without fit parameters) and another one with hits with the fit parameters, a branch TMultiGraph with the graphs of the superpositions and another branch TClonesArray with TFitResult instances of the fits. Apparently everything works well when I process a group of files with only one file with a superposition (file 12 is first file with a superposition). So, when I run ./analysis.exe /eth/ethraid5/home/dnarrias/data_Daniel-Thomas/15Nov/Waveforms MI-1_687_ampl 20 RT_687_test.root, the program works, but when I run on 30 instead of 20 files, when processing file 29 with superpositions, the programs crashes. May the problem be an allocation error/accessing non allocated memory one?. Unfortunately, I don't see where the problem is in the code... The error message I get is the following one:
Code:
*** glibc detected *** ./analysis.exe: free(): invalid next size (fast): 0x0a38dc90 ***
======= Backtrace: =========
/lib/libc.so.6[0x78c3ee5]
/lib/libc.so.6(cfree+0x59)[0x78c4329]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0x46455c1]
/usr/lib/libstdc++.so.6(_ZdaPv+0x1d)[0x464561d]
/eth/sw/ROOT/5.30.00/i386-linux/root/lib/libCore.so(_ZN7TStringD1Ev+0x35)[0x8eb69a5]
/eth/sw/ROOT/5.30.00/i386-linux/root/lib/libCore.so(_ZN14TPluginManager26LoadHandlersFromPluginDirsEPKc+0xc7)[0x8e91e77]
/eth/sw/ROOT/5.30.00/i386-linux/root/lib/libCore.so(_ZN14TPluginManager11FindHandlerEPKcS1_+0x28)[0x8e93638]
/eth/sw/ROOT/5.30.00/i386-linux/root/lib/libMathCore.so(_ZN4ROOT4Math7Factory15CreateMinimizerERKSsS3_+0xd7)[0x2dc6cb7]
/eth/sw/ROOT/5.30.00/i386-linux/root/lib/libMathCore.so(_ZN4ROOT3Fit9FitConfig15CreateMinimizerEv+0x61)[0x2dc83c1]
/eth/sw/ROOT/5.30.00/i386-linux/root/lib/libMathCore.so(_ZN4ROOT3Fit6Fitter15DoInitMinimizerEv+0xcb)[0x2dd3d2b]
/eth/sw/ROOT/5.30.00/i386-linux/root/lib/libMathCore.so(_ZN4ROOT3Fit6Fitter14DoMinimizationERKNS_4Math21IBaseFunctionMultiDimEPS4_+0x48)[0x2dd4a48]
/eth/sw/ROOT/5.30.00/i386-linux/root/lib/libMathCore.so(_ZN4ROOT3Fit6Fitter16DoLeastSquareFitERKNS0_7BinDataE+0x378)[0x2dd6348]
/eth/sw/ROOT/5.30.00/i386-linux/root/lib/libHist.so(_ZN4HFit3FitI6TGraphEE13TFitResultPtrPT_P3TF1R9Foption_tRKN4ROOT4Math16MinimizerOptionsEPKcRNS9_3Fit9DataRangeE+0xb44)[0x4d13e4]
/eth/sw/ROOT/5.30.00/i386-linux/root/lib/libHist.so(_ZN4ROOT3Fit9FitObjectEP6TGraphP3TF1R9Foption_tRKNS_4Math16MinimizerOptionsEPKcRNS0_9DataRangeE+0x57)[0x4ca047]
/eth/sw/ROOT/5.30.00/i386-linux/root/lib/libHist.so(_ZN6TGraph3FitEP3TF1PKcS3_dd+0x160)[0x53ecc0]
./analysis.exe(_Z12OverlapSplitPdidRPiddiRP11TMultiGraphR12TClonesArrayid+0x814)[0x804c92e]
./analysis.exe(main+0x92b)[0x804d527]
/lib/libc.so.6(__libc_start_main+0xdc)[0x7871e9c]
./analysis.exe(_ZN10TCanvasImp8StreamerER7TBuffer+0x39)[0x804bfe1]
======= Memory map: ========
00110000-00287000 r-xp 00000000 00:1a 17343246 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libGraf.so
00287000-0028f000 rwxp 00177000 00:1a 17343246 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libGraf.so
0028f000-00297000 rwxp 0028f000 00:00 0
00297000-002df000 r-xp 00000000 00:1a 17343333 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libPostscript.so
002df000-002e1000 rwxp 00048000 00:1a 17343333 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libPostscript.so
002e1000-00325000 r-xp 00000000 00:1a 17343202 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libThread.so
00325000-00328000 rwxp 00044000 00:1a 17343202 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libThread.so
00328000-0032b000 r-xp 00000000 fd:00 13632988 /lib/libdl-2.5.so
0032b000-0032c000 r-xp 00002000 fd:00 13632988 /lib/libdl-2.5.so
0032c000-0032d000 rwxp 00003000 fd:00 13632988 /lib/libdl-2.5.so
0032e000-00349000 r-xp 00000000 fd:00 13631499 /lib/ld-2.5.so
00349000-0034a000 r-xp 0001a000 fd:00 13631499 /lib/ld-2.5.so
0034a000-0034b000 rwxp 0001b000 fd:00 13631499 /lib/ld-2.5.so
0034b000-003db000 r-xp 00000000 00:1a 17343332 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libPhysics.so
003db000-003de000 rwxp 00090000 00:1a 17343332 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libPhysics.so
003de000-003fd000 r-xp 00000000 00:13 8155630 /eth/ethraid5/home/dnarrias/data_Daniel-Thomas/photondet/trace/PMTSignalsAnalysiscam/pmtTools/libPmtTools.so
003fd000-003fe000 rwxp 0001e000 00:13 8155630 /eth/ethraid5/home/dnarrias/data_Daniel-Thomas/photondet/trace/PMTSignalsAnalysiscam/pmtTools/libPmtTools.so
003fe000-00425000 r-xp 00000000 fd:00 13632989 /lib/libm-2.5.so
00425000-00426000 r-xp 00026000 fd:00 13632989 /lib/libm-2.5.so
00426000-00427000 rwxp 00027000 fd:00 13632989 /lib/libm-2.5.so
00430000-00431000 r-xp 00430000 00:00 0 [vdso]
00431000-00875000 r-xp 00000000 00:1a 17343244 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libHist.so
00875000-00889000 rwxp 00443000 00:1a 17343244 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libHist.so
00889000-0088c000 rwxp 00889000 00:00 0
0088c000-00a81000 r-xp 00000000 00:1a 17343245 /eth/sw/ROOTAborted
The analysis.cxx script is below.
Code:
//creating fit Functor
class exp_functor {
public:
exp_functor(int nn){ nHits = nn;}
double operator() (const double *x, const double *p) {
double fit = 0.;
for(int i = 0; i < nHits; i++) fit += hit(x[0], p[3*i], p[3*i+1], p[3*i+2]);
return fit;
}
//this is the fit function for one hit
double hit(double x, double p0, double p1, double p2){
double h = p0*(x-p1)*exp(-(x-p1)/p2);
if(x < p1) return 0.;
else return h;
}
private:
int nHits;
};
double* OverlapSplit(double* inputPars, int nHitsOverlap, double lastWidth, int*& wave, double vGain, double vOffset, int nevent, TMultiGraph*& MultiGOverlap, TClonesArray& fitResultArray, int nOverlap, double pedestal){
//nOverlap is the number of an overlap in an event.
// inputPars[n]:StartTime, inputPars[n+1]:riseTime, inputPars[n+2]:maximum. n: number of hit in the superposition. Only vertical parameters are in V, horizontal parameters (times) are in ns (sampling time 4ns).
double* outputPars = new double[40];
// outputPars[n]: riseTime, outputPars[n+1]:scalar (= maximum* e / riseTime), output[n+2]:offset (startTime).
double *hitOverlap = new double[200];//let's assume a hit has 50 samples, 50*4=200ns width. If we consider superpositions with up to 4 hits, 50*4=200 samples:number of elements in this array.
const double e = exp(1.0);
double StartOverlap = *inputPars;
*hitOverlap = 0.;
//At this point start's and width's are double but integer numbers, ex. 4., 12., etc.
for(int ii = (int)(StartOverlap/4); ii <= (int)(*(inputPars + 3*(nHitsOverlap-1))) + (int)(lastWidth/4); ii++) *(hitOverlap + ii + 1 - (int)(StartOverlap/4)) = (vGain*(double)wave[ii] - vOffset)-pedestal;
for(int ii = (int)(*(inputPars + 3*(nHitsOverlap-1))) + (int)(lastWidth/4) + 1; ii < (int)(StartOverlap/4) + 199; ii++) *(hitOverlap + ii + 1 - (int)(StartOverlap/4)) = 0.;
double *times = new double[200];
for(int ii = 0; ii < 200; ii++) *(times + ii) = StartOverlap + 4*(ii - 1);//time in ns, [StartOverlap-4, StartOverlap + 199*4).
TGraph *GOverlap = new TGraph(200, times, hitOverlap);
char *overlapName = new char[200];
sprintf(overlapName, "startOverlap%dns_nOverlap%d_event%d", StartOverlap, nOverlap, nevent);
GOverlap->SetName(overlapName);
char *overlapTitle = new char[200];
char *startTimesTitle = new char[180];
sprintf(startTimesTitle, "Start Hit1: %dns, Start Hit%d: %dns ", *inputPars, nHitsOverlap, *(inputPars + 3*(nHitsOverlap-1)));
sprintf(overlapTitle, "%s; nOverlap: %d; event: %d", startTimesTitle, nOverlap, nevent);
GOverlap->SetTitle(overlapTitle);
GOverlap->SetMarkerStyle(20);
GOverlap->SetMarkerSize(1);
GOverlap->SetMarkerColor(1);
char *fitFunctName = new char[80];
sprintf(fitFunctName, "fitfunction_startOverlap%dns_event%d", StartOverlap, nevent);
exp_functor *fit = new exp_functor(nHitsOverlap);
TF1 *fitFunction = new TF1("fitFunction", fit, StartOverlap -4, StartOverlap -4 + 4*100, 3*nHitsOverlap, "exp_functor");//+4*200 but we assume last half is empty data
for(int i = 0; i < nHitsOverlap; i++){
fitFunction->SetParameter( 3*i, e*(*(inputPars + 3*i + 2))/(*(inputPars + 3*i + 1)));
fitFunction->SetParameter( 3*i + 1, *(inputPars + 3*i));
fitFunction->SetParameter( 3*i + 2, *(inputPars + 3*i + 1));
}
char *ParName = new char[15];
char *scalar = new char[10];
char *offset = new char[10];
char *riseTime = new char[10];
sprintf(scalar, "scalar");
sprintf(offset, "offset");
sprintf(riseTime, "riseTime");
for(int i = 0; i < nHitsOverlap; i++){
sprintf(ParName, "%s%d", scalar, i);
fitFunction->SetParName(3*i, ParName);
sprintf(ParName, "%s%d", offset, i);
fitFunction->SetParName(3*i + 1, ParName);
sprintf(ParName, "%s%d", riseTime, i);
fitFunction->SetParName(3*i + 2, ParName);
}
fitFunction->SetLineColor(2);
TFitResultPtr fitResultPtr;
fitResultPtr = GOverlap->Fit(fitFunction, "RS");
new(fitResultArray[nOverlap]) TFitResult((*fitResultPtr.Get()));
MultiGOverlap->Add(GOverlap);
//we could get all the parameters in one line: const double* TFitResult::GetParams(), but we want to keep our dynamically allocated pointer outputPars.
for(int i = 0; i < nHitsOverlap; i++){
*(outputPars + 3*i) = fitFunction->GetParameter(3*i + 2);
*(outputPars + 3*i + 1) = fitFunction->GetParameter(3*i);
*(outputPars + 3*i + 2) = fitFunction->GetParameter(3*i + 1);
}
delete[] overlapTitle;
delete[] startTimesTitle;
delete[] fitFunctName;
delete[] ParName;
delete[] scalar;
delete[] offset;
delete[] riseTime;
fitFunction->TF1::~TF1();
delete[] overlapName;
delete[] times;
delete[] hitOverlap;
return outputPars;
}
//outputs a root file with reduced events
int main(int argc, char *argv[]){
if(argc != 5){
fprintf(stderr, "%s <inputFolderName> <inputFileBaseName> <numberOfEvents> <outputFileName>\n\n", argv[0]);
return 1;
}
int ii, cnt = 0, nn = atoi(argv[3]);
FILE * file;
int *wave;
double vGain, vOffset;
TFile * out = new TFile(argv[4], "RECREATE");
TTree * tree = new TTree("tree", argv[4]);
waveform * wa = new waveform();
event * ev = new event();
event * rEv = new event();
//OBS: TClonesArray and TObjArray can only collect classes which inherit from TObject. TFitResultPtr doesn't inherit from TObject. On the other hand, TFitResult does inherit from TObject.
TClonesArray *PfitResultArray = new TClonesArray("TFitResult", 6);
TClonesArray &fitResultArray = *PfitResultArray;
TMultiGraph *MultiGOverlap = new TMultiGraph("MultiGOverlaps", "MultiGOverlaps");//default constructor
tree->Branch("Event", "event", &ev, 32000, 0);
tree->Branch("reducedEvent", "event", &rEv, 32000, 0);
tree->Branch("FitResultArray", "TClonesArray", &PfitResultArray, 32000, 0);
tree->Branch("MultiGraphOverlap", "TMultiGraph", &MultiGOverlap, 32000, 0) ;
double* inputPars = new double[40];
double* outputPars = new double[40];
int nHitsOverlap = 1;
int nOverlap = 0;
double lastWidth;
vector<hit> hits;
hit Hit, prevHit;
double pedestal;
const double e = exp(1.0);
const double a = exp(-5.0);
double scalar, riseTime, offset, integral, maximum;
char fileName[128];
for(ii = 0; ii < nn; ii++){
sprintf(fileName, "%s/C1%s%05d.trc", argv[1], argv[2], ii);
if(ii < 60) continue; //.trc file is corrupt
if((file = fopen(fileName, "r")) == NULL){
fclose(file);
continue;
}
wa->importLeCroyBinary(file);
fclose(file);
if((wa->getWave()) == NULL){
continue;
}
ev->reduce(wa, 32, 2., 6);// 32*4ns = 128ns < pedestalWidth; 2.*noise = threshold; 6*4ns=24ns < minimumHitWidth accepted.
*rEv = *ev;
if(ev->getnHits() > 1){
wave = wa->getWave();
vGain = wa->getyDelta();
vOffset = wa->getyOffset();
hits = ev->getHits();
pedestal = ev->getPedestal();
for(int j = 1; j < ev->getnHits(); j++){
prevHit = hits.at(j-1);
Hit = hits.at(j);
if(prevHit.getGroupOverlap() == Hit.getGroupOverlap()){
*(inputPars + 3*(nHitsOverlap-1)) = prevHit.getStart();//in ns units
*(inputPars + 3*(nHitsOverlap-1) + 1) = prevHit.getRiseTime();
*(inputPars + 3*(nHitsOverlap-1) + 2) = prevHit.getMaximum();
*(inputPars + 3*nHitsOverlap) = Hit.getStart();
*(inputPars + 3*nHitsOverlap + 1) = Hit.getRiseTime();
*(inputPars + 3*nHitsOverlap + 2) = Hit.getMaximum();
lastWidth = Hit.getWidth();
nHitsOverlap++;
if(j == (ev->getnHits()-1)){
printf("nHits: %d, event %d\n", ev->getnHits(), ii);
outputPars = OverlapSplit(inputPars, nHitsOverlap, lastWidth, wave, vGain, vOffset, ii, MultiGOverlap, fitResultArray, nOverlap, pedestal);
printf("Hola");
for(int k = 0; k < nHitsOverlap; k++){
riseTime = *(outputPars + 3*k);
scalar = *(outputPars + 3*k + 1);
offset = *(outputPars + 3*k + 2);
maximum = scalar*riseTime/e + pedestal;
integral = scalar*riseTime*riseTime*(1-6*a)/5 + 5*riseTime*pedestal/5;//to obtain the charge, the integral must be divided by 50Ohm, we divide by 5 and the charge is in [e-10 C] units ---- With the model we use for hit fitting, time(9%ofMaximum)=5.022*riseTime, which we consider as hitWidth. By adding the last term to the integral, we're allowed to plot charge with pedestal charge and then correct the charge.
printf("Pedestal: %f V\n", pedestal);
printf("Start%d\tnOverlap%d\tevent%d\n", (int)(*inputPars), nOverlap, ii);
printf("-------------------- Hit%d\tStart: (a)%f (b)%f\tPeakTime: (a)%f (b)%f\tRisetime: (a)%f (b)%f\tWidth: (a)%f (b)%f\n-------------------------\tMaximum: (a)%f (b)%f\tIntegral: (a)%f (b)%f\n", k, (hits.at(j-nHitsOverlap+k+1)).getStart(), offset, (hits.at(j-nHitsOverlap+k+1)).getPeakTime(), offset + riseTime, (hits.at(j-nHitsOverlap+k+1)).getRiseTime(), riseTime, (hits.at(j-nHitsOverlap+k+1)).getWidth(), 5*riseTime, (hits.at(j-nHitsOverlap+k+1)).getMaximum(), maximum, (hits.at(j-nHitsOverlap+k+1)).getIntegral(), integral);
hit tmp;
tmp.init(offset, riseTime, 5*riseTime, offset + riseTime, maximum, integral, prevHit.getGroupOverlap());
rEv->replaceHit(j-nHitsOverlap+k+1, tmp);
}
}
} else if(nHitsOverlap > 1){
printf("nHits: %d, event %d\n", ev->getnHits(), ii);
outputPars = OverlapSplit(inputPars, nHitsOverlap, lastWidth, wave, vGain, vOffset, ii, MultiGOverlap, fitResultArray, nOverlap, pedestal);
for(int k = 0; k < nHitsOverlap; k++){
riseTime = *(outputPars + 3*k);
scalar = *(outputPars + 3*k + 1);
offset = *(outputPars + 3*k + 2);
maximum = scalar*riseTime/e + pedestal;
integral = scalar*riseTime*riseTime*(1-6*a)/5 + 5*riseTime*pedestal/5;
printf("Pedestal: %f V\n", pedestal);
printf("Start%d\tnOverlap%d\tevent%d\n",(int)(*inputPars), nOverlap, ii);
printf("-------------------- Hit%d\tStart: (a)%f (b)%f\tPeakTime: (a)%f (b)%f\tRisetime: (a)%f (b)%f\tWidth: (a)%f (b)%f\n-------------------------\tMaximum: (a)%f (b)%f\tIntegral: (a)%f (b)%f\n", k, (hits.at(j-nHitsOverlap+k)).getStart(), offset, (hits.at(j-nHitsOverlap+k)).getPeakTime(), offset + riseTime, (hits.at(j-nHitsOverlap+k)).getRiseTime(), riseTime, (hits.at(j-nHitsOverlap+k)).getWidth(), 5*riseTime, (hits.at(j-nHitsOverlap+k)).getMaximum(), maximum, (hits.at(j-nHitsOverlap+k)).getIntegral(), integral);
hit tmp;
tmp.init(offset, riseTime, 5*riseTime, offset + riseTime, maximum, integral, prevHit.getGroupOverlap());//initializes a hit
rEv->replaceHit(j-nHitsOverlap+k, tmp);
}
nOverlap++;
nHitsOverlap = 1;
}
}
}
nOverlap = 0;
nHitsOverlap = 1;
if(ii%1000 == 0) fprintf(stderr, "%6d\t%6d\r", cnt, nn);
cnt++;
tree->Fill();
//Reinitialize fitResult and MultiGOverlap.
fitResultArray.Clear();
MultiGOverlap->TMultiGraph::~TMultiGraph();
MultiGOverlap = new TMultiGraph("MultiGOverlaps", "MultiGOverlaps");
hits.clear();
}
fprintf(stderr, "%6d\t%6d\n", cnt, nn);
delete wa;
delete ev;
delete rEv;
tree->Print();
tree->Write();
out->Close();
return 0;
}
Below find a bt from gdb.
Code:
#0 0x00f2c402 in __kernel_vsyscall ()
#1 0x053eedf0 in raise () from /lib/libc.so.6
#2 0x053f0701 in abort () from /lib/libc.so.6
#3 0x05425bcb in __libc_message () from /lib/libc.so.6
#4 0x0542dee5 in _int_free () from /lib/libc.so.6
#5 0x0542e329 in free () from /lib/libc.so.6
#6 0x026ba5c1 in operator delete(void*) () from /usr/lib/libstdc++.so.6
#7 0x026ba61d in operator delete[](void*) () from /usr/lib/libstdc++.so.6
#8 0x058229a5 in TString::~TString() () from /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libCore.so
#9 0x057fde77 in TPluginManager::LoadHandlersFromPluginDirs(char const*) () from /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libCore.so
#10 0x057ff638 in TPluginManager::FindHandler(char const*, char const*) () from /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libCore.so
#11 0x035a6cb7 in ROOT::Math::Factory::CreateMinimizer(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libMathCore.so
#12 0x035a83c1 in ROOT::Fit::FitConfig::CreateMinimizer() () from /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libMathCore.so
#13 0x035b3d2b in ROOT::Fit::Fitter::DoInitMinimizer() () from /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libMathCore.so
#14 0x035b4a48 in ROOT::Fit::Fitter::DoMinimization(ROOT::Math::IBaseFunctionMultiDim const&, ROOT::Math::IBaseFunctionMultiDim const*) ()
from /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libMathCore.so
#15 0x035b6348 in ROOT::Fit::Fitter::DoLeastSquareFit(ROOT::Fit::BinData const&) () from /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libMathCore.so
#16 0x003eb3e4 in TFitResultPtr HFit::Fit<TGraph>(TGraph*, TF1*, Foption_t&, ROOT::Math::MinimizerOptions const&, char const*, ROOT::Fit::DataRange&) ()
from /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libHist.so
#17 0x003e4047 in ROOT::Fit::FitObject(TGraph*, TF1*, Foption_t&, ROOT::Math::MinimizerOptions const&, char const*, ROOT::Fit::DataRange&) ()
from /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libHist.so
#18 0x00458cc0 in TGraph::Fit(TF1*, char const*, char const*, double, double) () from /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libHist.so
#19 0x0804c8b9 in OverlapSplit(double*, int, double, int*&, double, double, int, TMultiGraph*&, TClonesArray&, int, int, double) ()
#20 0x0804d8bd in main ()
but it doesn't help me much...
When I exclude the first 60 files and run the executable until the file number 95, the execution finishes well and it processes fine all the files with superpositions, but when run on files until the number 100, it crashes. The error message I get is the following:
Code:
*** glibc detected *** ./analysis.exe: malloc(): memory corruption: 0x08fda278 ***
======= Backtrace: =========
/lib/libc.so.6[0x2042c1d]
/lib/libc.so.6(__libc_malloc+0x67)[0x20447d7]
/usr/lib/libstdc++.so.6(_Znwj+0x27)[0x8730b87]
/usr/lib/libstdc++.so.6(_Znaj+0x1d)[0x8730cbd]
./analysis.exe(_Z12OverlapSplitPdidRPiddiRP11TMultiGraphR12TClonesArrayid+0x25a)[0x804c374]
./analysis.exe(main+0x938)[0x804d534]
/lib/libc.so.6(__libc_start_main+0xdc)[0x1fefe9c]
./analysis.exe(_ZN10TCanvasImp8StreamerER7TBuffer+0x39)[0x804bfe1]
======= Memory map: ========
00110000-0013d000 r-xp 00000000 00:1a 17343334 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libRint.so
0013d000-0013f000 rwxp 0002c000 00:1a 17343334 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libRint.so
0013f000-00187000 r-xp 00000000 00:1a 17343333 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libPostscript.so
00187000-00189000 rwxp 00048000 00:1a 17343333 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libPostscript.so
00189000-0018c000 r-xp 00000000 fd:00 13632988 /lib/libdl-2.5.so
0018c000-0018d000 r-xp 00002000 fd:00 13632988 /lib/libdl-2.5.so
0018d000-0018e000 rwxp 00003000 fd:00 13632988 /lib/libdl-2.5.so
0018e000-00199000 r-xp 00000000 fd:00 13632373 /lib/libgcc_s-4.1.2-20080825.so.1
00199000-0019a000 rwxp 0000a000 fd:00 13632373 /lib/libgcc_s-4.1.2-20080825.so.1
001a0000-001bf000 r-xp 00000000 00:13 8155680 /eth/ethraid5/home/dnarrias/data_Daniel-Thomas/photondet/trace/PMTSignalsAnalysiscam/pmtTools/libPmtTools.so
001bf000-001c0000 rwxp 0001e000 00:13 8155680 /eth/ethraid5/home/dnarrias/data_Daniel-Thomas/photondet/trace/PMTSignalsAnalysiscam/pmtTools/libPmtTools.so
001c2000-001c3000 r-xp 001c2000 00:00 0 [vdso]
001c3000-002c2000 r-xp 00000000 00:1a 17343282 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libGraf3d.so
002c2000-002c8000 rwxp 000fe000 00:1a 17343282 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libGraf3d.so
002c8000-002cb000 rwxp 002c8000 00:00 0
002cb000-0030f000 r-xp 00000000 00:1a 17343202 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libThread.so
0030f000-00312000 rwxp 00044000 00:1a 17343202 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libThread.so
00312000-00327000 r-xp 00000000 fd:00 13631685 /lib/libpthread-2.5.so
00327000-00328000 --xp 00015000 fd:00 13631685 /lib/libpthread-2.5.so
00328000-00329000 r-xp 00015000 fd:00 13631685 /lib/libpthread-2.5.so
00329000-0032a000 rwxp 00016000 fd:00 13631685 /lib/libpthread-2.5.so
0032a000-0032c000 rwxp 0032a000 00:00 0
0032e000-00349000 r-xp 00000000 fd:00 13631499 /lib/ld-2.5.so
00349000-0034a000 r-xp 0001a000 fd:00 13631499 /lib/ld-2.5.so
0034a000-0034b000 rwxp 0001b000 fd:00 13631499 /lib/ld-2.5.so
0034b000-0078f000 r-xp 00000000 00:1a 17343244 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libHist.so
0078f000-007a3000 rwxp 00443000 00:1a 17343244 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libHist.so
007a3000-007a6000 rwxp 007a3000 00:00 0
007a6000-0091d000 r-xp 00000000 00:1a 17343246 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libGraf.so
0091d000-00925000 rwxp 00177000 00:1a 17343246 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libGraf.so
00925000-0092d000 rwxp 00925000 00:00 0
0092d000-00b22000 r-xp 00000000 00:1a 17343245 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libTree.so
00b22000-00b2c000 rwxp 001f5000 00:1a 17343245 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libTree.so
00b2c000-00b2e000 rwxp 00b2c000 00:00 0
00b2e000-00d70000 r-xp 00000000 00:1a 17343241 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libMatrix.so
00d70000-00d77000 rwxp 00242000 00:1a 17343241 /eth/sw/ROOT/5.30.00/i386-linux/root/lib/libMatrix.so
00d77000-00d79000 rwxp 00d77000 00:00 0
00d79000-00da0000 r-xp 00000000 fd:00 13632989 /lib/libm-2.5.so
00da0000-00da1000 r-xp 00026000 fd:00 13632989 /lib/libm-2.5.so
00da1000-00da2000 rwxp 00027000 fd:00 13632989 /lib/libm-2.5.so
00da2000-00db4000 r-xp 00000000 fd:00 13632991 /lib/libz.so.1.2.3
00db4000-00db5000 rwxp 00011000 fd:00 13632991 /lib/libz.so.1.2.3
00db5000-00dd4000 r-xp 00000000 fd:00 13632926 /lib/libpcre.so.0.0.1
Aborted
and the bt is
Code:
#0 0x00360402 in __kernel_vsyscall ()
#1 0x06ec6df0 in raise () from /lib/libc.so.6
#2 0x06ec8701 in abort () from /lib/libc.so.6
#3 0x06efdbcb in __libc_message () from /lib/libc.so.6
#4 0x06f06c1d in _int_malloc () from /lib/libc.so.6
#5 0x06f087d7 in malloc () from /lib/libc.so.6
#6 0x00c97b87 in operator new(unsigned int) () from /usr/lib/libstdc++.so.6
#7 0x00c97cbd in operator new[](unsigned int) () from /usr/lib/libstdc++.so.6
#8 0x0804c374 in OverlapSplit(double*, int, double, int*&, double, double, int, TMultiGraph*&, TClonesArray&, int, double) ()
#9 0x0804d534 in main ()
I'm puzzled...
I know that only with this information it's difficult for you to figure out how to fix the problem. Please let me know if interested and I send you the whole macro so you can run the program. It's a hugeee program with all the class implementations ( event, hit) and other classes to get data from binary files and handle the data ( waveform, readLeCroyBinary classes, etc), let alone the necessary data binary files.
I hope that someone looking for challenging code/ROOT problems gets interested in this one.
Thanks in advance.
Daniel
|