Re: [ROOT] SEGV varying with the number of lines in the program

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue May 20 2003 - 10:45:48 MEST


Hi Valery,

 looks like your are running out of memory. While running does the
memory increase (check with top).

Cheers, Fons.



On Tue, 2003-05-20 at 09:05, Miftakov, Valery wrote:
> Hi,
> 
> In my short program accessing MySQL database I am experiencing spurious SEGVs. There is a loop over all rows in the returned TSQLResult. At the 4th iteration, the program crashes.
> 
> Here is the piece of code (fragment from inside the loop):
> //------------------------- try fitting here -------------------------
>       TH1D *fitHistos[3];
>       char histname[255];
>       sprintf(histname, "fithist_p_%s", ticker); cout << histname << endl; fitHistos[0]=new TH1D(histname, histname, n_values, 0, n_values);
>       sprintf(histname, "fithist_index_%s", ticker); cout << histname << endl; fitHistos[1]=new TH1D(histname, histname, n_values, 0, n_values);
>       sprintf(histname, "fithist_%s", ticker); cout << histname << endl; fitHistos[2]=new TH1D(histname, histname, n_values, 0, n_values);
>       for(int i=1; i<=n_values; i++) {
> 	fitHistos[0]->SetBinContent(i, p[i]);
> 	fitHistos[1]->SetBinContent(i, indices[i]);
> 	fitHistos[2]->SetBinContent(i, p[i]/indices[i]);
>       }
>       c1->cd(1); fitHistos[2]->Draw("hist");
>       c1->cd(2); fitHistos[0]->Draw("hist");
>       c1->cd(3); fitHistos[1]->Draw("hist");
> //--------------------------------------------------------------------
> 
> The crash happens in the 3rd TH1D constructor above, with the following debugger output:
> ----------------------------------------
> Program received signal SIGSEGV, Segmentation fault.
> 0x413cb6f2 in chunk_alloc (ar_ptr=0x41460ce0, nb=24) at malloc.c:2764
> 2764	malloc.c: No such file or directory.
> Current language:  auto; currently c
> (gdb) where
> #0  0x413cb6f2 in chunk_alloc (ar_ptr=0x41460ce0, nb=24) at malloc.c:2764
> #1  0x413cb5ae in __libc_malloc (bytes=16) at malloc.c:2696
> #2  0x413611e6 in __builtin_new (sz=16) from /usr/lib/libstdc++-libc6.1-1.so.2
> #3  0x401713ac in TList::NewLink () from /mnt/disk1/physics/root_3.05//lib/root/libCore.so
> #4  0x40170aa7 in TList::AddLast () from /mnt/disk1/physics/root_3.05//lib/root/libCore.so
> #5  0x4016f15b in THashList::AddLast () from /mnt/disk1/physics/root_3.05//lib/root/libCore.so
> #6  0x4017213e in TList::Add () from /mnt/disk1/physics/root_3.05//lib/root/libCore.so
> #7  0x40114ac0 in TDirectory::Append () from /mnt/disk1/physics/root_3.05//lib/root/libCore.so
> #8  0x4078293d in TH1::Build () from /mnt/disk1/physics/root_3.05//lib/root/libHist.so
> #9  0x40781d61 in TH1::TH1 () from /mnt/disk1/physics/root_3.05//lib/root/libHist.so
> #10 0x40793f77 in TH1D::TH1D () from /mnt/disk1/physics/root_3.05//lib/root/libHist.so
> #11 0x804c590 in HFHelp::getRank (_server=0x88b23b8, ticker=0xbfffee58 "TTIL", time_end=970810200, mode=2, 
>     params=0xbfffee24, c1=0x88b5c88, debug=1) at HFHelp.hh:138
> #12 0x804aa1d in main (argc=7, argv=0xbffff634) at HFTrader.cc:204
> -----------------------------------------
> 
> Please note that the program went through several identical iterations already before crashing...
> 
> Any help would be appreciated.
> 
> I am using root 3.05/05 under RedHat Linux 7.2.
> 
> Thanks,
> Valery.
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET