Re: Detecting memory leaks with libpq?

Поиск
Список
Период
Сортировка
От dennis jenkins
Тема Re: Detecting memory leaks with libpq?
Дата
Msg-id CAAEzAp_B64x627F3j-Q7FOpC9ZgzNJMoNWaA0e5bqwMi76u3Cg@mail.gmail.com
обсуждение исходный текст
Ответ на Detecting memory leaks with libpq?  (Antonio Vieiro <antonio@antonioshome.net>)
Список pgsql-general


On Tue, Jul 19, 2011 at 5:41 AM, Antonio Vieiro <antonio@antonioshome.net> wrote:
Hi all,

I'm building a small C application that uses libpq and I was wondering
if there's an easy way to detect memory leaks in my code.

I think I'm calling PQclear and friends correctly, but I'd like to
double-check it. I was wondering if there's a function in libpq to
check memory-use usage/internals, or something like that.

Wrap your main logic in a loop that runs it 100,000 or more times.  However, the process itself should never exit (eg, only ever exist as one pid).  As the process runs, monitor it with top, htop (really nice util for Linux), vmstat, etc...  Does the memory usage go up and up, generally linearly with time?

Run the same process using "electronic fence" [1] or "valgrind" [2].

[1] http://linux.die.net/man/3/efence  (not for finding memory leaks per se, but useful for finding memory mis-usage.
[2] http://valgrind.org/

В списке pgsql-general по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Identify release contents
Следующее
От: Rebecca Clarke
Дата:
Сообщение: Database Restore Fail - No liblwgeom.so