Hello Rene,
On Thursday 22 May 2003 20:03, you wrote:
> Hi Paolo,
>
> When you use a TClonesArray, a statement like:
> new (Drawer[h]) TC_Drawer()
>
> -creates a new object , allocating memory and calling the constructor
> if Drawer[h] is null
> -calls only the constructor if Drawer[h] is non null.
>
> Assuming that you create a maximum of 6 objects in your function and you
> call the function 1000 times, only 6 objects will be allocated.
That's fine, but in my case even if I know that 6 objects must be allocated
I can't see anyone of them. I will be more explicit.
I have one TC_RawData containing a pointer to a TClonesArray of six
TC_Drawer. Inside each TC_Drawer there is a pointer to a TClonesArray of
another class TC_PMTChannel, which is a simple "box", a class containing only
simple variables and performing no operation. I have 48 TC_PMTChannel for
each TC_Drawer so that in total there are 288 TC_PMTChannel.
After performing the allocation I can see, with the help of gObjectTable,
-1 TC_RawData
-288 TC_PMTChannel
BUT NO TC_Drawer, even if I never call the destructor, when program crashes,
and ONLY ONE TC_Drawer when runs correctly. That's the strange thing and I
suppose this behaviour can light on some ideas on program crash.
Note that also the number of TClonesArray is reported correctly.
Just for reference I copy here the stack trace:
*** Break *** segmentation violation
Generating stack trace...
0x401aa93b in TUnixSystem::StackTrace(void) + 0x25b from
/home/pcatlas3/data0/root/lib/libCore.so
0x401a95ba in TUnixSystem::DispatchSignals(ESignals) + 0xb2 from
/home/pcatlas3/data0/root/lib/libCore.so
0x401a8763 in <unknown> from /home/pcatlas3/data0/root/lib/libCore.so
0x401ac1fd in <unknown> from /home/pcatlas3/data0/root/lib/libCore.so
0x40c22f75 in <unknown> from /lib/i686/libpthread.so.0
0x42029188 in <unknown> from /home/pcatlas3/data0/root/bin/root.exe
0x405e04bb in G__CallFunc::Exec(void *) + 0x77 from
/home/pcatlas3/data0/root/lib/libCint.so
0x40172528 in TClass::BuildRealData(void *) + 0x28c from
/home/pcatlas3/data0/root/lib/libCore.so
0x40ad67cd in TTree::BuildStreamerInfo(TClass *, void *) + 0x31 from
/home/pcatlas3/data0/root/lib/libTree.so
0x40ad61a6 in TTree::Bronch(char const *, char const *, void *, int, int) +
0x2ce from /home/pcatlas3/data0/root/lib/libTree.so
0x40ad4f96 in TTree::Branch(char const *, char const *, void *, int, int) +
0x42 from /home/pcatlas3/data0/root/lib/libTree.so
0x41287621 in TC_RawData::CreateBranches(TTree *) + 0x105 from
/home/users/adragna/tilemonitor/tilemonitor/src_prova/./TC_RawData_cpp.so
0x412add51 in TC_DataConnection::AcquireNewEvent(TTree *, bool) + 0x261 from
/home/users/adragna/tilemonitor/tilemonitor/src_prova/./TC_DataConnection_cpp.so
0x412dd0f6 in TC_MainFrame::HandleButton(int) + 0x19a from
/home/users/adragna/tilemonitor/tilemonitor/src_prova/./TC_MainFrame_cpp.so
0x412defa2 in <unknown> from
/home/users/adragna/tilemonitor/tilemonitor/src_prova/./TC_MainFrame_cpp.so
0x405e04bb in G__CallFunc::Exec(void *) + 0x77 from
/home/pcatlas3/data0/root/lib/libCint.so
0x4012f617 in TQConnection::ExecuteMethod(void) + 0x37 from
/home/pcatlas3/data0/root/lib/libCore.so
0x40131d46 in TQObject::Emit(char const *) + 0x2ae from
/home/pcatlas3/data0/root/lib/libCore.so
0x410c5d9d in TGButton::Clicked(void) at
/usr/src/build/85131-i386/BUILD/glibc-2.2.4/stdlib/atexit.c:33 from
/home/pcatlas3/data0/root/lib/libGui.so
0x40f4e01e in TGButton::SetState(EButtonState) + 0xee from
/home/pcatlas3/data0/root/lib/libGui.so
0x40f4e0ff in TGButton::HandleButton(Event_t *) + 0x93 from
/home/pcatlas3/data0/root/lib/libGui.so
0x40f6634a in TGFrame::HandleEvent(Event_t *) + 0x1e2 from
/home/pcatlas3/data0/root/lib/libGui.so
0x40f58612 in TGClient::HandleEvent(Event_t *) + 0xb2 from
/home/pcatlas3/data0/root/lib/libGui.so
0x40f58322 in TGClient::ProcessOneEvent(void) + 0x5a from
/home/pcatlas3/data0/root/lib/libGui.so
0x40f583b6 in TGClient::HandleInput(void) + 0x2e from
/home/pcatlas3/data0/root/lib/libGui.so
0x40f5684d in TGInputHandler::Notify(void) + 0x21 from
/home/pcatlas3/data0/root/lib/libGui.so
0x401a8feb in TUnixSystem::DispatchOneEvent(bool) + 0x3b from
/home/pcatlas3/data0/root/lib/libCore.so
0x40146669 in TSystem::InnerLoop(void) + 0x1d from
/home/pcatlas3/data0/root/lib/libCore.so
0x401465fe in TSystem::Run(void) + 0x7e from
/home/pcatlas3/data0/root/lib/libCore.so
0x40103f2d in TApplication::Run(bool) + 0x31 from
/home/pcatlas3/data0/root/lib/libCore.so
0x40be8f96 in TRint::Run(bool) + 0x2ba from
/home/pcatlas3/data0/root/lib/libRint.so
0x08048802 in main + 0x52 from /home/pcatlas3/data0/root/bin/root.exe
0x42017589 in __libc_start_main + 0x95 from
/home/pcatlas3/data0/root/bin/root.exe
0x080486d1 in __register_frame_info + 0x35 from
/home/pcatlas3/data0/root/bin/root.exe
>
>
> Concerning your second problem, replace the lines:
> for (unsigned int j=0; j<fNFrag; ++j)
> {
> sprintf(title, "Drawer %d", j);
> cout << title << endl;
>
> >----------------------------------------------------------------<
>
> tree->Branch(title, "TC_Drawer", &(Drawer[j]), 32000, 3);
>
> >-----------------------------------------------------------------<
>
> }
> cout <<"Branches made up"<<endl;
> }
>
> by
>
> tree->Branch("Drawers","TClonesArray",&fDrawer,32000,3);
>
> Rene
>
The program was originally so written, but in such a way I could split
TC_PMTChannel because of two TClonesArray nested (the one with TC_Drawer and
the other).
I come back trying to solve this enigma. Sorry for my being always long, but I
think it's necessary.
Thanks,
Paolo
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET