John, You have a huge memory leak in your test. Not a surprise that the system becomes slower and slower. You should delete your histograms from memory as soon as you have drawn them. Rene brun On Thu, 13 Jun 2002, Frankland John wrote: > Hi ROOTers > > The following macro is supposed to open a root file, and then display > sequentially one > after the other the 3D histograms in the file, as a film (it's supposed > to show a collision > between two "nuclei"). > Unfortunately, after the first four or five "frames" execution slows > down until the while > PC comes to a grinding halt. > Can anybody tell me why ? > Cheers > John. > PS. I use ROOT 3.03.05 on an i686 PC running RedHat 7.3 > > klassFilm.C: > { > #include <stdlib.h> > #include <fstream.h> > gROOT->Reset(); > TCanvas *c1 = new TCanvas("c1","klassik film",600,600); > gStyle->SetOptStat(kFALSE); > TFile *f; > char fnom[]="klassik_5000_b3.root"; > char name[10]; TH3D *h1; > int tplot=0; > sprintf(name,"Pxyz%d",tplot); > > f=new TFile(fnom); > while( (h1 = (TH3D*)f->Get(name)) ) > { > // projectile nucleons > h1->SetMarkerStyle(24); > h1->SetMarkerColor(2); > h1->SetMarkerSize(1); > h1->Draw(); > // target nucleons > sprintf(name,"Txyz%d",tplot); > h1 = (TH3D*)f->Get(name); > h1->SetMarkerStyle(24); > h1->SetMarkerColor(4); > h1->SetMarkerSize(1); > h1->Draw("same"); > c1->Update(); > // cycle on > tplot+=5; > sprintf(name,"Pxyz%d",tplot); > } > } > > -- > Dr. J.D. Frankland > Grand Accelérateur National d'Ions Lourds > Boulevard Henri Bécquerel > B.P. 55027 > 14076 CAEN Cedex 05 > > tél.: +33 (0)231454628 > fax: +33 (0)231454665 > mél: frankland@ganil.fr > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:56 MET