Re: [ROOT] Memory Leakage and TMessage

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon May 08 2000 - 19:23:31 MEST


Hi Thomas,

   if you don't delete the objects you receive, because you still need
them then it is not a memory leakage problem, but a simple case of 
memory usage. To prevent your program from using excessive amounts
of memory you must delete once in a while the objects you've received.
As shown in the hserv.C example, the received histogram is deleted after
it has been drawn.

Cheers, Fons.



On Mon, May 08, 2000 at 01:35:24PM +0200, Thomas Eberl wrote:
> Dear rooters,
> 
> i work with 2.23/12 under RedHat6.0 on a PII-400.
> 
> I have looked to the Client/Server Example and I try to send my own
> objects that are derived from TObject between two computers. It works
> fine, but I don't know how to delete the received object in a clean way.
> I want to assign the received object to a data member of my "data
> receiving" class to be able to use it somewhere else in the code. If I
> just copy the pointer everyhting works fine, but the memory consumption
> grows as long as the program runs until it crashes.
> ----------- 
> } else if (mess->What() == kMESS_OBJECT) {
> 	    printf("got object of class: %s\n", mess->GetClass()->GetName());
> 	    HMatrixCategory * catmHRichRawtmp = (HMatrixCategory *)
> mess->ReadObject(mess->GetClass());
> catmHRichRaw = catmHRichRawtmp;
> -----------
> on the other hand, if I delete catmHRichRawtmp my data is gone
> obviously.
> 
> Why is it necessary anyway to delete this object ? Is there another way
> to program it ?
> Do I have to copy all the data into another object to save it ?
> 
> Please help
> 
> Thomas 
> -- 
> Thomas Eberl                       Phone: (+49 89) 289 1 2429   
> Physik-Department E12, Technische Universitaet Muenchen
> James-Franck-Strasse *** D-85748 Garching b. Muenchen
> Email: Thomas.Eberl@physik.tu-muenchen.de

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:24 MET