Re: valgrind a background worker

2023-03-16 Thread Jon Erdman
On 2/10/23 9:08 PM, Jon Erdman wrote: > On 2/10/23 3:05 PM, Tom Lane wrote: >> Jeffrey Walton writes: >>> On Fri, Feb 10, 2023 at 10:04 AM Tom Lane wrote: You have to valgrind the whole cluster AFAIK.  Basically, start the postmaster under valgrind with --trace-children=yes. For l

Re: valgrind a background worker

2023-02-11 Thread Jon Erdman
On 2/10/23 3:05 PM, Tom Lane wrote: > Jeffrey Walton writes: >> On Fri, Feb 10, 2023 at 10:04 AM Tom Lane wrote: >>> You have to valgrind the whole cluster AFAIK. Basically, start >>> the postmaster under valgrind with --trace-children=yes. >>> For leak tracking you probably also want >>> --leak

Re: valgrind a background worker

2023-02-10 Thread Tom Lane
Jeffrey Walton writes: > On Fri, Feb 10, 2023 at 10:04 AM Tom Lane wrote: >> You have to valgrind the whole cluster AFAIK. Basically, start >> the postmaster under valgrind with --trace-children=yes. >> For leak tracking you probably also want >> --leak-check=full --track-origins=yes --read-var-

Re: valgrind a background worker

2023-02-10 Thread Jeffrey Walton
On Fri, Feb 10, 2023 at 10:04 AM Tom Lane wrote: > > =?UTF-8?Q?Jon_Erdman?= writes: > > I've got a background worker that has a slow memory leak in it > > somewhere. How can I get it to start under valgrind to get a memcheck > > output from it? > > You have to valgrind the whole cluster AFAIK. B

Re: valgrind a background worker

2023-02-10 Thread Tom Lane
=?UTF-8?Q?Jon_Erdman?= writes: > I’m suspecting that the leak might be coming from initStringInfo(), as I see > a palloc() in there and no associated pfree() in my background worker’s code, > but looking at the elog backend code, it looks like maybe you only have to > explicitly free buf if you

Re: valgrind a background worker

2023-02-10 Thread Jon Erdman
Aha! Thanks Tom! This will be my first time using valgrind, so I was unaware of trace-children, and getting it to attach to forked stuff was exactly where I thought the difficulty would lie. This is great, much appreciated! I’m suspecting that the leak might be coming from initStringInfo(),

Re: valgrind a background worker

2023-02-10 Thread Tom Lane
=?UTF-8?Q?Jon_Erdman?= writes: > I've got a background worker that has a slow memory leak in it > somewhere. How can I get it to start under valgrind to get a memcheck > output from it? You have to valgrind the whole cluster AFAIK. Basically, start the postmaster under valgrind with --trace-ch