Hi pg-hackers,

I have written a postgres extension, and know that memory leak check can be
done with valgrind. With the help of postgres_valgrind_wiki
<https://wiki.postgresql.org/wiki/Valgrind> started postgres server with
the valgrind(as given in the wiki)

valgrind --leak-check=no --gen-suppressions=all \
    --suppressions=src/tools/valgrind.supp --time-stamp=yes \
    --error-markers=VALGRINDERROR-BEGIN,VALGRIND ERROR-END \
    --log-file=$HOME/pg-valgrind/%p.log --trace-children=yes \
    postgres --log_line_prefix="%m %p " \
    --log_statement=all --shared_buffers=64MB 2>&1 | tee
$HOME/pg-valgrind/postmaster.log

I have few doubts in here,

1. When I run with *--leak-check=full*, I get memory leaks for postgres
functions under possibly or definitely lost categories.. Is this expected?
If yes, how shall i ignore it?(by creating .supp?).. kindly suggest
2. Is there any other way to test my extension memory leaks alone, because
combining with postgres leaks is making instrumentation complex?..
3. I have seen some macros for valgrind support within postgres source code
under utils/memdebug.h, but couldn't get complete idea of using it from the
comments in pg_config_manual.h under *USE_VALGRIND *macro, pls provide some
guidance here..

Thank you,
Natarajan R

Reply via email to