Search Postgresql Archives

Re: Memory leak somewhere at PQconnectdb?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/09/11 22:08, Antonio Vieiro wrote:
> Hi all,
> 
> I'm running one of my programs with valgrind to check for memory leaks
> and I'm seeing something like this:

You only get the one report, though, right? No matter how many times
PQconnectdb is run in a loop?

It's internal stuff within OpenSSL. If you really want to you can call:

  CONF_modules_free()

before your program terminates, to make sure OpenSSL cleans up its data
structures. Just make sure nobody else has registered an atexit()
handler that touches OpenSSL or you'll get fireworks.

PostgreSQL (libpq) should not be responsible for cleaning up OpenSSL,
and *cannot* be reliably responsible for it. If libpq tried to clean up
OpenSSL it might well "clean" it while other libraries or the main
application code was still using it for something else.

If you want to avoid this warning, call OPENSSL_config yourself before
doing anything in libpq, and call CONF_modules_free before exit. That
way libpq's call to OPENSSL_config becomes a no-op and you have full
control of OpenSSL's init and cleanup.

Even better, add a valgrind suppressions file for the warnings and
ignore them. They are "leaks" only in the sense that a static variable
is a leak, ie not at all.

If you see that the program grows if you run it many times in a loop,
and you get more and more leak records for every loop, *THEN* there
might be a problem.


--
Craig Ringer

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux