Re: [ROOT] seg. violation pain in the neck

From: Jiri Masik (masik@fzu.cz)
Date: Wed Apr 09 2003 - 17:28:19 MEST


Dmitri Litvintsev <litvinse@fnal.gov> writes:

> Hi ROOTers,
>
> well, this is typical picture:
>
> root [27] TH1 h100 = (*h5)-(*h6);
> root [28] h100.Draw();
>
>  *** Break *** segmentation violation
> Root >
>
>  *** Break *** segmentation violation
> Root >
>
>  *** Break *** segmentation violation
> Root >
>
> I forgot to type 'F' (TH1 istead of TH1F)
> How can I recover from '*** Break *** segmentation violation' ?
>
> all I can manage is to ^Z, kill root, start all over again. Is it the only
> way? I understand that I need to type right, but the punishment seems to
> be to severe especially in the case when in order to get to that point you
> need to run macros for half and hour.
>

Hi Dmitri,

from the general point of view Root and cint don't protect against
memory management errors. 

Some internal Root data are overwritten here. The interpreter is only
checking whether a statement is valid or not. In this particular case
the statement is valid so there is no reason to stop. The memory is
overwritten and the problem lies in the TH1 classes - (maybe
instantiation of TH1 objects could be forbidden?)

On the other hand the command-line validity checks in the interpreter
could be also improved. Consider a similar situation: assignment
operations between TH1F and TH1D are not implemented
 
  TH1D *h1 = new TH1D("h1","",10,0.,1.);
  TH1F h = (*h1);  //

but they can be freely performed in the interpreter. 
Please correct me if I'm wrong.
cheers

Jiri



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