Re: [ROOT] memory leak in TNtuple::Query / TTreeResult ?

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Sep 24 2001 - 02:44:35 MEST


Hi Andre,

  I've fixed the memory leak in the TTreeResult dtor. Fix in CVS.
Please try again and let me know.

Cheers, Fons.


On Sunday 23 September 2001 18:50, Andre Holzner wrote:
> Hello rooters,
>
>
> I'm using root 3.01/06 (10 August 2001) on Linux/i386.
> I have the following small program:
>
> #include <unistd.h>
> #include <stdlib.h>
> #include <TFile.h>
> #include <TNtuple.h>
> #include <TSQLResult.h>
> #include <cassert>
> #include <strstream>
>
> //----------------------------------------------------------------------
>
> void mem_usage()
> {
>   static pid_t pid = getpid();
>
>   ostrstream buf;
>   buf << "ps u -p " << pid << ends;
>   system(buf.str());
> }
>
> //----------------------------------------------------------------------
>
> void main()
> {
>   TFile *f = new TFile("hsimple.root"); assert(f!=NULL);
>   TNtuple *tuple = (TNtuple *)f->Get("ntuple");  assert(tuple != NULL);
>
>   int i;
>
>   for (i=0; i<10000; ++i)
>     {
>       TSQLResult *query_res =
>         tuple->Query("px:py:pz:random:i");
>       delete query_res;
>
>       if (i % 10 == 0)
>         {
>           cout << "i=" << i << endl;
>           mem_usage();
>
>         }
>     }
> }
>
>
> hsimple.root is the one from the $ROOTSYS/tutorials/ .
> Now I expect this program to reach a constant memory usage after
> the first iteration. However, the output which I get is the following:
>
> i=0
> USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
> holzner  18875 99.9  7.6 28732 20044 pts/5   S    18:43   0:03 ./test
> i=10
> USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
> holzner  18875 98.4 30.0 87328 78640 pts/5   S    18:43   0:29 ./test
> i=20
> USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
> holzner  18875 98.3 52.4 145924 137236 pts/5 S    18:43   0:56 ./test
>
>
> i.e. there is increase in memory usage of 58M per 10 iterations.
> Or am I missing something ?
>
> best regards & many thanks,
>
>
> André

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:00 MET