Re: [ROOT] deleting pointers

From: Benjamin E. Norman (bnorman@star.physics.kent.edu)
Date: Thu Mar 27 2003 - 03:10:57 MET


Hi Javier,
	First of all, since you didn't actually create the TNtuple with 'new',
you shouldn't delete it.  Root is taking care of the memory using the
TFile.  If you delete the TFile first, Root has already deleted the
TNtuple, and trying to delete it again causes a segfault.  If you delete
the TNtuple first, I think the TFile is smart enough so that it doesn't
try to delete it again, and so you don't get a segfault.

-Ben

jgonzalez@neuub0.physics.neu.edu wrote:
 > Hi all
 >
 > In the program I give you attached I get a segmentetion fault when I
 > delete the file first and then delete the ntuple. It works ok if I do it
 > the other way. Any idea why this is happening?. Note that the thing does
 > nothing! it declares my ntuple, my file, finds the ntuple, sets some
 > friends, sets the addresses, loops over the ntuple doing nothing, deletes
 > everything...
 > that's it.
 >
 > Javier


-- 
Benjamin E. Norman            Kent State University Physics Dept
bnorman@kent.edu                                 Kent, OH  44240
330-672-0098                                                 USA


-- 
Benjamin E. Norman            Kent State University Physics Dept
bnorman@kent.edu                                 Kent, OH  44240
330-672-0098                                                 USA



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