Re: [HACKERS] aggregation memory leak and fix

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: riedel+(at)CMU(dot)EDU (Erik Riedel)
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] aggregation memory leak and fix
Date: 1999-03-20 13:17:36
Message-ID: 199903201317.IAA21354@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> > No apologies necessary. Glad to have someone digging into that area of
> > the code. We will gladly apply your patches to 6.5. However, I request
> > that you send context diffs(diff -c). Normal diffs are just too
> > error-prone in application. Send them, and I will apply them right
> > away.
> >
> Context diffs attached. This was due to my ignorance of diff. When I
> made the other files, I though "hmm, these could be difficult to apply
> if the code has changed a bit, wouldn't it be good if they included a
> few lines before and after the fix". Now I know "-c".

I have had to back out the nodeAgg.c part of the patch. The rest looks
OK, partly because it is dealing with freeing expression context, and
partly because I don't understand it all.

The nodeAgg.c part of the patch is clearly trying to free memory
allocated as intermediate parts of the expression, and has to be solved
by a more general solution as I discussed.

If you look in backend/utils/adt/*.c, you will see lots of intermediate
memory allocated. The allocacations as part of the *in/*out functions
are not a problem, because they are called only in other areas, and are
freed, but the other ones are probably not free'ed until statement
termination. I may need to specifically put those pfree's in their own
context, and free them on tuple completion.

I am waiting to hear what others say about my ideas. Feel free to keep
digging.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-03-20 13:17:56 Re: [HACKERS] min() and max() causing aborts
Previous Message Bruce Momjian 1999-03-20 12:50:44 Re: [HACKERS] aggregation memory leak and fix