Hi Rooters, I have a very basic question regarding memory management. In compiled code (using ROOT classes), using operator delete on instances of ROOT classes sometimes causes a segfault later on. (Of course I don't use the pointer after "delete", but nonetheless the program dumps core. And of course I don't use delete on automatic variables.) Omitting the deletion of dynamic instances of ROOT classes (TBRIK comes to my mind) seems _not_ to lead to a memory leak - how come? In some example programs in the tutorial you use constructs like mat = new TMaterial("mat1","HYDROGEN",1.01,1,.0708); mat = new TMaterial("mat2","DEUTERIUM",2.01,1,.162); mat = new TMaterial("mat3","HELIUM",4,2,.125); mat = new TMaterial("mat4","LITHIUM",6.94,3,.534); and so on. (From tutorials/na49.C.) "Normally" this is an absolute C++ no-no, but with ROOT it does not produce leaks. Who is actually responsible for memory management for the ROOT classes? Does the interpreter do memory management even when using a compiler? If it does, then how does it realize a pointer in the compiled C++ code goes out of scope so the pointee is to be deleted? Is there a web page dedicated to memory management? Cheers, patrick (who is pretty confused) -- Patrick Schemitz, schemitz@ekp.physik.uni-karlsruhe.de University of Karlsruhe (TH), Germany Faculty for Physics, EKP, Ka'CDF Tracking Group
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:37 MET