From: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | "'Peter Kroon *EXTERN*'" <plakroon(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: conn = PQconnectdb(conninfo); |
Date: | 2015-07-31 10:05:53 |
Message-ID: | A737B7A37273E048B164557ADEF4A58B50F8AB8B@ntex2010i.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Peter Kroon wrote:
> I've found perhaps a bug.
> I've narrowed down my code and the problem is indeed at: conn = PQconnectdb(conninfo);
>
> My connection string: host=192.168.178.12 dbname=DATABASE user=foo password=bar
>
> When I remove key/value host=xxx then everything is OK. Valgrind mentions: no leaks are possible.
>
> When key/value host=xxx is added, not everything is freed and there are tons of bytes still reachable.
>
>
> ==9195==
> ==9195== HEAP SUMMARY:
> ==9195== in use at exit: 450,080 bytes in 2,829 blocks
> ==9195== total heap usage: 9,476 allocs, 6,647 frees, 7,810,733 bytes allocated
> ==9195==
> ==9195== LEAK SUMMARY:
> ==9195== definitely lost: 0 bytes in 0 blocks
> ==9195== indirectly lost: 0 bytes in 0 blocks
> ==9195== possibly lost: 0 bytes in 0 blocks
> ==9195== still reachable: 450,080 bytes in 2,829 blocks
> ==9195== suppressed: 0 bytes in 0 blocks
> ==9195== Rerun with --leak-check=full to see details of leaked memory
> ==9195==
> ==9195== For counts of detected and suppressed errors, rerun with: -v
> ==9195== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 14 from 6)
>
>
>
> The network address is the machine's address where I was testing on. So I could also have used
> localhost or 127.0.0.1 but this gave me the same result when using the network address.
>
>
> Played with hostaddr as well and gave me the same result.
>
>
> http://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-PQCONNECTDB
> http://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS
> "PostgreSQL 9.4.4 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.7.2-5) 4.7.2, 64-bit"
>
>
> The attachment is the program I've used for testing.
You should run valgrind with --leak-check=full to see details.
I tried your program and I get "still reachable" only when SSL is enabled; all the memory is in
OpenSSL. Dou you use SSL?
Without SSL (sslmode=disable) I get no "still reachable" memory.
I don't know of reachable memory is a problem, I'd suspect not.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Andrey Lizenko | 2015-07-31 10:52:28 | multiple postgres processes after establishing tcp connection |
Previous Message | Renato Oliveira | 2015-07-31 06:34:34 | Re: [GENERAL] How Many PG_Locks are considered too many |