Hi Rene, your answer to one of my previous mails was, that my problem is due to problems with my destructors, but: 1) As you stated in another mail, reading won't call a destructor for each mail. 2) see the attached classes/example. It is a very simple example. Copile it and try 'create.C' first. Afterwards run 'test.C' and find out how memory usage (and swapping) is growing very fast! Maybe there is somthing wrong with the code. But I don't have an idea anymore what can be wrong with 15 lines of code. I'm using root 3.01/06, Linux 7.1 With Kernal 2.2 and Kernal 2.4. Best regards, Thomas. #include "MArrayB.h" ClassImp(MArrayB); #include "MParContainer.h" ClassImp(MParContainer); #include "MRawEvtData.h" #include "MArrayB.h" ClassImp(MRawEvtData); MRawEvtData::MRawEvtData() { fHiGainFadcSamples = new MArrayB; } MRawEvtData::~MRawEvtData() { delete fHiGainFadcSamples; } #ifndef MARS_MArrayB #define MARS_MArrayB #include <string.h> #include <TObject.h> class MArrayB : public TObject { private: UInt_t fN; // Number of array elements Byte_t *fArray; //[fN] Array of fN chars public: MArrayB() { fN = 1024*15; fArray = new Byte_t[fN]; } virtual ~MArrayB() { delete [] fArray; } ClassDef(MArrayB, 1) //Array of Byte_t }; #endif #ifndef __CINT__ #endif // __CINT__ #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class MArrayB; #pragma link C++ class MRawEvtData; #pragma link C++ class MParContainer+; #endif #ifndef MARS_MParContainer #define MARS_MParContainer #include <TObject.h> class MParContainer : public TObject { ClassDef(MParContainer, 0) //The basis for all parameter containers }; #endif #ifndef MARS_MRawEvtData #define MARS_MRawEvtData #include "MParContainer.h" class MArrayB; class MRawEvtData : public MParContainer { private: MArrayB *fHiGainFadcSamples; // list of hi gain samples of all pixels (ordering: see fHiGainPixId) public: MRawEvtData(); ~MRawEvtData(); ClassDef(MRawEvtData, 1) //Container to store the raw Event Data }; #endif ################################################################## # # makefile # # for the MARS software # ################################################################## # @maintitle # @code # # please change all system depend values in the # config.mk.${OSTYPE} file # # include Makefile.conf.$(OSTYPE) include Makefile.conf.general # PROGRAMS = SOLIB = test.so CINT = M # # connect the include files defined in the config.mk file # # WARNING: the result (whether the linkage works or not) depends on the # order of the libraries. It seems, that the most base library # must be the last one # # # ----->>> mars libraries # SUBDIRS = LIBRARIES = $(SUBDIRS:=.a) MRPROPERS = $(SUBDIRS:=.mrproper) CLEANERS = $(SUBDIRS:=.clean) #------------------------------------------------------------------------------ .SUFFIXES: .c .cc .h .o SRCFILES = MParContainer.cc MArrayB.cc MRawEvtData.cc SRCS = $(SRCFILES) HEADERS = $(SRCFILES:.cc=.h) OBJS = $(SRCFILES:.cc=.o) ############################################################ all: rmlib $(PROGRAMS) $(SOLIB) @echo " Done. " @echo " " # Use $(CXX) -v ... for a more verbose output # # We could link mars.so instead of all libraries. This would need # some MBs less space on the HD. But this means, that the Shared # Library Path in your system must be set properly to be able to start # 'mars' # $(PROGRAMS): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o $(PROGRAMS:=.o) @echo " Linking $@ ..." $(CXX) $(CXXFLAGS) $@.o $(OBJS) $(MARS_LIB) MCint.o $(ROOTGLIBS) -o $@ $(SOLIB): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o @echo " Linking $(SOLIB) ..." $(CXX) -shared $(CXXFLAGS) $(OBJS) MCint.o $(ROOTGLIBS) -o $@ include Makefile.rules clean: rmcint rmobjs rmcore rmlib rm -f *.so # @endcode # # ----->>> root libraries # ROOTVER = `root-config --version` ROOTLIBS = `root-config --libs` ROOTGLIBS = `root-config --glibs` ROOTCFLAGS = `root-config --cflags` # # compiler flags # DEFINES = -D__MARS__ -DROOTVER=\"$(ROOTVER)\" $(ARCHDEF) CXXFLAGS = $(ROOTCFLAGS) $(INCLUDES) $(OPTIM) $(DEBUG) $(DEFINES) CFLAGS = $(CXXFLAGS) FFLAGS = $(CXXFLAGS) ################################################################## # # config.mk # # @file config.mk # ################################################################## # @maintitle # @code # compilers CC = gcc CXX = g++ F77 = f77 AR = ar -rc # # ----->>> settings for compilation # OPTIM = -O3 -Wall -fno-rtti -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs DEBUG = -g ARCHDEF = -D__LINUX__ MARS_LIB = -Llib $(SUBDIRS:%=-l%) INCLUDES = -I. $(SUBDIRS:%=-I%) # uncomment this for quiet compilation .SILENT: # @endcode ##EOF depend: @makedepend $(SRCS) $(INCLUDES) -I$(INCLUDE_CPLUS) $(ROOTCFLAGS) \ -f Makefile.depend 2> kk.kk ; cat kk.kk $(LIB): $(OBJS) $(HEADERS) $(CINT)Cint.o @echo " - Building Library lib$(LIB)" $(AR) $(LIB) *.o @echo " " $(CINT)Cint.cc: $(HEADERS) @echo " - Generating dictionary $(CINT)Cint.cc" $(ROOTSYS)/bin/rootcint -f $(CINT)Cint.cc \ -c $(INCLUDES) $(DEFINES) $(HEADERS) $(CINT)Incl.h $(CINT)LinkDef.h .cxx.o: @echo " - Compiling" $< $(CXX) $(CXXFLAGS) -c $< -o $@ .cc.o: @echo " - Compiling" $< $(CXX) $(CXXFLAGS) -c $< -o $@ .c.o: @echo " - Compiling" $< $(CC) $(CFLAGS) -c $< -o $@ # # The cleaning facility # rmcint: @echo " Removing cint-stuff..." @rm -f *Cint.* rmlib: @echo " Removing libraries..." @echo " " @rm -f lib/lib*.a lib*.a rmobjs: @echo " Removing object files..." @rm -f *.o rmcore: @echo " Removing core files..." @rm -f core* rmbin: @echo " Removing binary files..." @rm -f $(PROGRAMS) lib/$(SOLIB) so_locations rmbak: @echo " Removing backup files..." @rm -f *~ kk.kk *.bak rmbakmac: @echo " Removing backup files in macros" @rm -f macros/*~ rmhtml: @echo " Removing htmldoc-tree" @rm -rf htmldoc cflags: @echo $(INCLUDES) $(CXXFLAGS) /* ======================================================================== *\ ! ! * ! * This file is part of MARS, the MAGIC Analysis and Reconstruction ! * Software. It is distributed to you in the hope that it can be a useful ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. ! * It is distributed WITHOUT ANY WARRANTY. ! * ! * Permission to use, copy, modify and distribute this software and its ! * documentation for any purpose is hereby granted without fee, ! * provided that the above copyright notice appear in all copies and ! * that both that copyright notice and this permission notice appear ! * in supporting documentation. It is provided "as is" without express ! * or implied warranty. ! * ! ! ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de) ! ! Copyright: MAGIC Software Development, 2000-2001 ! ! \* ======================================================================== */ void create() { gSystem->Load("test.so"); MArrayB::Class()->IgnoreTObjectStreamer(); MParContainer::Class()->IgnoreTObjectStreamer(); MRawEvtData *evt=new MRawEvtData; TFile file("output-create.root", "RECREATE", 0); TTree *t=new TTree("Events", "Title"); t->Branch("MRawEvtData", "MRawEvtData", &evt, 320000); for (int i=0; i<2000; i++) t->Fill(); file.Write(); } /* ======================================================================== *\ ! ! * ! * This file is part of MARS, the MAGIC Analysis and Reconstruction ! * Software. It is distributed to you in the hope that it can be a useful ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. ! * It is distributed WITHOUT ANY WARRANTY. ! * ! * Permission to use, copy, modify and distribute this software and its ! * documentation for any purpose is hereby granted without fee, ! * provided that the above copyright notice appear in all copies and ! * that both that copyright notice and this permission notice appear ! * in supporting documentation. It is provided "as is" without express ! * or implied warranty. ! * ! ! ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de) ! ! Copyright: MAGIC Software Development, 2000-2001 ! ! \* ======================================================================== */ void test() { gSystem->Load("test.so"); MArrayB::Class()->IgnoreTObjectStreamer(); MParContainer::Class()->IgnoreTObjectStreamer(); MRawEvtData *evt=new MRawEvtData; TFile file("output-create.root", "READ"); TTree *t=file.Get("Events"); TBranch *br = t->GetBranch("MRawEvtData"); br->SetAddress(&evt); for (int i=0; i<2000; i++) t->GetEntry(i); }
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:07 MET