Valgrind mem-check for postgres extension - Mailing list pgsql-hackers

From Natarajan R
Subject Valgrind mem-check for postgres extension
Date
Msg-id CAPqxBt7+yyVV91J+=RnqeN_YpH2=gsD=+JLedvKLstEUTU9Biw@mail.gmail.com
Whole thread Raw
Responses Re: Valgrind mem-check for postgres extension
List pgsql-hackers
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 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

pgsql-hackers by date:

Previous
From: "shiy.fnst@fujitsu.com"
Date:
Subject: RE: Skipping schema changes in publication
Next
From: Amit Kapila
Date:
Subject: Re: Handle infinite recursion in logical replication setup