Re: Sending/Receiving TClonesArray

From: Yves Schutz (schutz@in2p3.fr)
Date: Fri Jan 29 1999 - 17:57:02 MET


Following my earlier message I changed 

 fEmCal = new TClonesArray("CAREmCell", 4); to  fEmCal = new
TClonesArray("CAREmCell", 20)

and 

 for (Int_t i=0; i<4; i++){ to for (Int_t i=0; i<20; i++){

I get then the error:

Fatal in <operator delete>: unreasonable size (139299912)
aborting

the same error already reported earlier:

http://root.cern.ch/cgi-bin/print_hit_bold.pl/root/roottalk/roottalk98/0806.html?sendingTClonesArray#first_hit

I am using Version   2.21/01 on PC-Linux

Yves 

Yves Schutz wrote:
> 
> Hi,
> 
> I have followed the directives from the client/server tutorial and
> from one of the entries to roottalk to send/receive a TClonesArray:
> 
> sender code:
> 
>    fEmCal = new TClonesArray("CAREmCell", 4);
> 
>     for (Int_t i=0; i<4; i++){
>      new( (*fEmCal)[i]) CAREmCell(i, i*10, i*20, i*30) ;
>     }
> 
>     TMessage mess(kMESS_OBJECT);       // sends a message
>     mess.Reset();
>     mess.WriteObject(fEmCal);
>     fSocket->Send(mess)
> 
> receiver code :
> 
>         TSocket  * s;
>         TMessage * mess=0;
>         TClonesArray * det=0;
> 
>         s = fMonitor->Select();
>         s->SetOption(kNoBlock,0);
>         Int_t status = s->Recv(mess);
> 
>         if (mess->What() == kMESS_OBJECT) {
>           TClass* clas = mess->GetClass();
>           if (clas) cout << clas->GetName() << endl ;
>           det = (TClonesArray *)mess->ReadObject(clas);
>           for (Int_t i=0; i < det->GetEntries(); i++){
>            CAREmCell * c = (CAREmCell *)(det->At(i));
> //         c->Print();
>           }
>         }
> 
> I get a segmentation fault on the line:
> 
>           det = (TClonesArray *)mess->ReadObject(clas);
> 
> with the following traceback:
> 
> #2 0x........ in TBuffer::ReadObject()
> #1 0x........ in TClonesArray::Streamer()
> #0 0x........ in TClass::New()
> 
> It becomes really ennoying when I uncomment the line:
> 
> //         c->Print();
> 
> then .... everything works fine!
> 
> Anybody has a clue to that ?
> 
> Thanks ... Yves
> --
>  __________________________________________________________________
> |Yves SCHUTZ  (IN2P3 - CNRS) collaboration TAPS/WA98/ALICE         |
> |SUBATECH                                                          |
> |Ecole des Mines de Nantes Telephone: (+33/0) 2 51 85 84 71        |
> |4, rue Alfred Kastler     Fax      : (+33/0) 2 51 85 84 79        |
> |F-44070 Nantes cedex 03   e-mail   : yves.schutz@subatech.in2p3.fr|
> |__________________________________________________________________|

-- 
 __________________________________________________________________
|Yves SCHUTZ  (IN2P3 - CNRS) collaboration TAPS/WA98/ALICE         | 
|SUBATECH                                                          |
|Ecole des Mines de Nantes Telephone: (+33/0) 2 51 85 84 71        | 
|4, rue Alfred Kastler     Fax      : (+33/0) 2 51 85 84 79        |
|F-44070 Nantes cedex 03   e-mail   : yves.schutz@subatech.in2p3.fr|
|__________________________________________________________________|



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:28 MET