RE: Error in <TExMap::Add>: key 2 is not unique

From: Philippe Canal <>
Date: Sat, 19 Mar 2005 00:12:10 -0600


> i cant afford any memory leak. so i am wondering
> why cant i delete classes cl and cl2.

The value returned by ReadClass is the value of TClass object that describe the class in question. There will always be at most one TClass object per class. A call to R__b.ReadClass may induced the creation of a TClass object (the first it is called for a specific class) but is more likely to return a pointer to an existing TClass. Not deleting it, does not result in a memory leak and deleting them will cause instability in the system (because the main ROOT objects are actually 'owning' those TClass objects)


-----Original Message-----
From: [] On Behalf Of Egon Pavlica
Sent: Friday, March 18, 2005 5:02 AM
Subject: [ROOT] Error in <TExMap::Add>: key 2 is not unique

Hello rooters!

Does anybody know this problem (i think is a problem). I have a class, child of a TObject, which has own Streamer. In this streamer i stream two members - classes, also children of TObject. These two members are pointers of type ClassA but actually they are any of classes ClassB or ClassC, that are children of ClassA, i use this procedure to stream:



TClass* cl=R__b.ReadClass();
classA1=(classA1*)R__b.ReadObjectAny(cl); //delete cl;
TClass* cl2=R__b.ReadClass();
classA2=(classA2*)R__b.ReadObjectAny(cl2); //delete cl2;

this reading gives the error:
Error in <TExMap::Add>: key 2 is not unique

that really confuse me. i cant afford any memory leak. so i am wondering why cant i delete classes cl and cl2. Also, it there any other posibility to stream classes classB and classC, which addresses are stored in classA1 and classA2.

Egon Pavlica Received on Sat Mar 19 2005 - 07:14:48 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:06 MET