From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Alex Hunsaker <badalex(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Christian Schröder <cs(at)deriva(dot)de> |
Subject: | Re: Memory leakage associated with plperl spi_prepare/spi_freeplan |
Date: | 2013-03-02 02:38:47 |
Message-ID: | 1706.1362191927@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Alex Hunsaker <badalex(at)gmail(dot)com> writes:
> On Tue, Feb 26, 2013 at 3:56 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I'm inclined to think the right fix is to make a small memory context
>> for each prepared plan made by plperl_spi_prepare(). The qdesc for it
>> could be made right in the context (getting rid of the unchecked
>> malloc's near the top of the function), the FmgrInfos and their
>> subsidiary data could live there too, and plperl_spi_freeplan could
>> replace its retail free's with a single MemoryContextDelete.
> Seemed fairly trivial, find the above approach in the attached.
Applied with some fixes.
> I added a
> CHECK_FOR_INTERRUPTS() at the top of plperl_spi_prepare(), it was fairly
> annoying that I couldn't ctrl+c my way out of test function.
Good idea, but it wasn't safe where it was --- needs to be inside the
PG_TRY(), so as to convert from postgres to perl error handling.
> One annonce is it still leaks :-(.
I fixed that, at least for the function-lifespan leakage from
spi_prepare() --- is that what you meant?
> It would be nice to squish the other leaks due to perm_fmgr_info()... but
> this is a start.
Yeah, I'm sure there's more left to do in the area --- but at least you
can create and free plans without it leaking.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Alex Hunsaker | 2013-03-02 04:17:07 | Re: Memory leakage associated with plperl spi_prepare/spi_freeplan |
Previous Message | Florian Weimer | 2013-03-01 21:51:13 | Re: posix_fadvise missing in the walsender |