AW: [ROOT] Memory Leakage and TMessage

From: Hemberger Dr. Marc (M.Hemberger@gsi.de)
Date: Mon May 08 2000 - 13:49:42 MEST


Hi Thomas,

do you delete the TMessage-object after you have made
mess->ReadObject(mess->GetClass()); ?
Try 'delete mess;' after you made the ReadObject.

I had this problem also once connected with a memory leak. Deleting the
'mess' cured it for me.

Greetings,

Marc

-----Ursprüngliche Nachricht-----
Von: Thomas Eberl [mailto:teberl@physik.tu-muenchen.de]
Gesendet: Montag, 8. Mai 2000 13:35
An: ROOT Mailinglist
Betreff: [ROOT] Memory Leakage and TMessage


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



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