Re: [ROOT] Delete Object

From: Kurt Rinnert (rinnert@ekp.physik.uni-karlsruhe.de)
Date: Thu Jul 03 2003 - 13:32:21 MEST


Hi Attilio,

this is a C++ issue: by doing 

root [6] pippo ppp

you are creating the object on the stack. It will be destroyed 
automatically when it goes out of scope (at least in compiled code...). 

Operator delete works on pointers to objects you created on the heap
with operator new, i.e.

root [6] pippo* ppp = new pippo()
root [7] delete ppp

works.

cheers,
	Kurt

On Thu, Jul 03, 2003 at 11:02:14AM +0200, Attilio Santocchia wrote:
> Hello Everybody
> very simple question:
> I have a tree named h1100
> I got an error when I try to delete an oblect using the folling command:
> 
> root [4] h1100->MakeClass("pippo")
> Info in <TTreePlayer::MakeClass>: Files: pippo.h and pippo.C generated from
> Tree: h1100
> (Int_t)0
> root [5] .L pippo.C
> root [6] pippo ppp
> root [7] delete ppp
> Error: ppp cannot delete FILE:/tmp/fileMKp30F_cint LINE:1
> *** Interpreter error recovered ***
> root [8]
> 
> What's the right command to delete the ppp object of the class pippo?
> 
> Cheers
> 
> Attilio

-- 
Kurt Rinnert, University of Karlsruhe (TH) - Faculty for Physics



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