Re: [HACKERS] Everything leaks; How it mm suppose to work?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: dg(at)illustra(dot)com (David Gould)
Cc: mgittens(at)gits(dot)nl, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Everything leaks; How it mm suppose to work?
Date: 1998-04-09 13:51:44
Message-ID: 199804091351.JAA12933@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Bruce:
> > Maurice:
> > > >Running postgresql in interactive mode shows that for each query I
> > > >type there is memory lost. The exact amount of memory lost depends on
> > > >the query I use. The amount of memory not freed is also a function
> > > >of the number of tuples returned.
> > > >
> > >
> > > Oops, it seems some palloced memory is not freed by pfree but
> > > using some other function(s).
> > > My mistake, sorry.
> > >
> >
> > One thing I have found is that:
> >
> > select * from test where 1=0;
> >
> > do not leak memory while
> >
> > select * from test where x=-999;
> >
> > does leak memory, even though neither returns any rows. Strange. Would
> > seem to point to the optimizer or executor.
>
> In the first case, the where clause is constant and evaluates false, so
> not much is done. In the second case, the table is scanned and presumably
> some memory is allocated for each row, probably to evaluate the expression.
> Since this memory is allocated into a per statement duration, it will not
> be freed until the end of the statement when the context is destroyed.

This will be fixed in the 6.3.2 patch, due out soon.

--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-04-09 14:39:31 Re: [HACKERS] Data types
Previous Message Thomas G. Lockhart 1998-04-09 13:25:15 Re: [HACKERS] Data types