Re: [ROOT] Delete Object

From: Victor Perevoztchikov (perev@bnl.gov)
Date: Mon Jul 07 2003 - 17:25:00 MEST


> for ROOT objects on the stack (pippo is made by MakeClass, so will inherit
> from TSelector (??)) you can use the Delete method, i.e. you can do

The stack objects can not be deleted by user at all. They are deleted automatically
by CINT or C++, when they are out of scope.

Victor
Victor M. Perevoztchikov   perev@bnl.gov         
Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
tel office : 631-344-7894; fax 631-344-4206; 

  ----- Original Message ----- 
  From: Frankland John 
  To: Kurt Rinnert 
  Cc: Attilio Santocchia ; roottalk@pcroot.cern.ch 
  Sent: Friday, July 04, 2003 1:00 AM
  Subject: Re: [ROOT] Delete Object


  Hi Attilio and Kurt

  for ROOT objects on the stack (pippo is made by MakeClass, so will inherit
  from TSelector (??)) you can use the Delete method, i.e. you can do

  pippo.Delete()

  Hope this helps

  John Frankland

  Kurt Rinnert wrote:

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
    

  



-- 
John D. Frankland
Beam Coordinator
GANIL
B.P. 55027
14076 CAEN Cedex 05

tel: +33 (0)231454628
fax: +33 (0)231454665



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