hi,
i've written a small example to illustrate a problem i found. i've 
attached several files:
HistoMaker.h: Class HistoMaker definition file.
LinkDef.h:    LinkDef i'm using 
macro.C:      An example macro
test.cc:      A compilable version of macro (without the plotting)
HistoMaker is a simple class with a function that returns a vector<TH1F*> 
of filled histos (it also allocates memory for the histos). if i call it 
once everything is ok. to avoid a memory leak, before i call it again i 
delete the histos i got the previous call (this is done in macro.C). 
the output i get when i run macro() is:
Iteration: 0
Ready to build hGaus_0...
Build successfull.
Ready to build hGaus_1...
Build successfull.
Ready to build hGaus_2...
Build successfull.
Ready to build hGaus_3...
Build successfull.
deleted hGaus_0
deleted hGaus_1
deleted hGaus_2
deleted hGaus_3
Iteration: 1
Ready to build hGaus_0...
  -   Break *** segmentation violation
 Generating stack trace...
 0x007d9c8d in THashTable::FindObject(char const*) const + 0x53 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCore.so.5.10
 0x007d8f68 in THashList::FindObject(char const*) const + 0x1e from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCore.so.5.10
 0x00eefd1a in TH1::Build() + 0x26a from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libHist.so.5.10
 0x00eee826 in TH1::TH1(char const*, char const*, int, double, double) + 
0x132 from /usr/local/root_v5.10.00.RHEL.gcc34/lib/libHist.so.5.10
 0x00f0508c in TH1F::TH1F(char const*, char const*, int, double, double) + 
0x48 from /usr/local/root_v5.10.00.RHEL.gcc34/lib/libHist.so.5.10
 0x01c70d44 in <unknown> from 
/export/dsk20/williams/delete_problem/././libHistoMaker.so
 0x001555b5 in G__ExceptionWrapper + 0x5d from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x00181577 in G__exec_asm + 0xaa7 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x002513a8 in G__exec_loop + 0x60e from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x00251956 in G__exec_for + 0x264 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x0025612b in G__exec_statement + 0x42fd from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x0021d5c8 in G__interpret_func + 0x26e0 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x0020128d in G__getfunction + 0x25e1 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x001f4be9 in G__getitem + 0x881 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x001f2a69 in G__getexpr + 0xdd69 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x0024be98 in G__exec_function + 0xd6 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x002564d6 in G__exec_statement + 0x46a8 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x001d1766 in G__exec_tempfile_core + 0x35a from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x001d1a13 in G__exec_tempfile_fp + 0x31 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x00260268 in G__process_cmd + 0x54ec from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCint.so.5.10
 0x007e8b55 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) 
+ 0x141 from /usr/local/root_v5.10.00.RHEL.gcc34/lib/libCore.so.5.10
 0x00713c08 in TApplication::ProcessLine(char const*, bool, int*) + 0x68a 
from /usr/local/root_v5.10.00.RHEL.gcc34/lib/libCore.so.5.10
 0x0055c0d4 in TRint::HandleTermInput() + 0x23a from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libRint.so.5.10
 0x0055a957 in TTermInputHandler::Notify() + 0x25 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libRint.so.5.10
 0x0055c58e in TTermInputHandler::ReadNotify() + 0x14 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libRint.so.5.10
 0x0088a72d in TUnixSystem::CheckDescriptors() + 0x163 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCore.so.5.10
 0x0088949c in TUnixSystem::DispatchOneEvent(bool) + 0x188 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCore.so.5.10
 0x007970d4 in TSystem::InnerLoop() + 0x20 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCore.so.5.10
 0x0079706d in TSystem::Run() + 0x7d from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCore.so.5.10
 0x00714483 in TApplication::Run(bool) + 0x37 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libCore.so.5.10
 0x0055ba41 in TRint::Run(bool) + 0x453 from 
/usr/local/root_v5.10.00.RHEL.gcc34/lib/libRint.so.5.10
 0x08048ea1 in main + 0x8d from 
/usr/local/root_v5.10.00.RHEL.gcc34/bin/root.exe 0x034e579a in 
__libc_start_main + 0xda from /lib/tls/libc.so.6
 0x08048d81 in TApplicationImp::ShowMembers(TMemberInspector&, char*) + 
0x35 from /usr/local/root_v5.10.00.RHEL.gcc34/bin/root.exe
Root > Function macro() busy flag cleared
 
if i comment out the delete histos[h] line, it runs the entire way through 
without seg faulting...but, of course, i get warning messages about 
replacing hGaus_0, etc., possible memory leak...
i'm not sure what's wrong here...am i just missing something or is this a 
bug?
also, test.cc is basically macro.C without the plotting, and it runs with 
no errors when compiled.
thanks,
mike williams
Received on Thu Apr 20 2006 - 18:00:17 MEST