Re: BUG #6234: Memory leak from PQexec - Mailing list pgsql-bugs

From Craig Ringer
Subject Re: BUG #6234: Memory leak from PQexec
Date
Msg-id CAD2md3Gb+gXTYR5fMk1m9OqWYUSwLu7TGxiYwK7gUnC9P+sw7A@mail.gmail.com
Whole thread Raw
In response to BUG #6234: Memory leak from PQexec  ("Vikas Mehta" <mehta@roguewave.com>)
List pgsql-bugs
On Oct 4, 2011 2:14 AM, "Vikas Mehta" <Vikas.Mehta@roguewave.com> wrote:
>
> Thanks. I found posts on SSL leak reported by purify. However, I couldn't
find any information on the memory leak from PQrequestCancel. Is it a known
issue?

It's essentially the same issue. OpenSSL loads some strings, config
variables etc on demand/first use and doesn't bother to free them. This is
fine because they are only ever loaded once, so there is no continuous
growth with repeated invocations and no leak. Freeing them before program
exit is hard because of ordering issues, so they just let the OS clean it up
with the rest of the process's memory. That's perfectly correct.

If repeat invocations of your problem code within one program session cause
the heap to grow and the reported leak to get bigger / appear more times,
THEN it is a real leak and a real bug.

>
> -----Original Message-----
> From: Craig Ringer [mailto:ringerc@ringerc.id.au]
> Sent: Friday, September 30, 2011 12:02 AM
> To: Vikas Mehta
> Cc: pgsql-bugs@postgresql.org
> Subject: Re: [BUGS] BUG #6234: Memory leak from PQexec
>
> On 29/09/2011 6:22 AM, Vikas Mehta wrote:
> > The following bug has been logged online:
> >
> > Bug reference:      6234
> > Logged by:          Vikas Mehta
> > Email address:      mehta@roguewave.com
> > PostgreSQL version: 8.4.8
> > Operating system:   Windows
> > Description:        Memory leak from PQexec
> > Details:
> >
> > Purify shows 448 bytes of memory leaks with PQexec:
> >
> > [W] Summary of all memory leaks... {448 bytes, 11 blocks}
> >      [W] MLK: Memory leak of 128 bytes from 1 block allocated in
> > ERR_load_SSL_strings [SSLEAY32.DLL]
> >
> It's not a leak, and it's not a bug. Please search the pgsql-general
archives for "valgrind" or "SSL_config".
>
> --
> Craig Ringer

pgsql-bugs by date:

Previous
From: Craig Ringer
Date:
Subject: Re: BUG #6237: Hang during install database initialization
Next
From: Craig Ringer
Date:
Subject: Re: BUG #6233: pg_dump hangs with Access Violation C0000005