public inbox for [email protected]
help / color / mirror / Atom feedFrom: Igor Korot <[email protected]>
To: David G. Johnston <[email protected]>
Cc: pgsql-generallists.postgresql.org <[email protected]>
Subject: Re: How to properly fix memory leak
Date: Sat, 26 Apr 2025 23:58:00 -0500
Message-ID: <CA+FnnTxb=A9F4qw1oN6noatGC0UtE6OUgDe+K-J08YFUaOfJXQ@mail.gmail.com> (raw)
In-Reply-To: <CAKFQuwZKp_FWZ0mi9H8th+fh70KeoV=4_6uB40TvQ9r1Q04UhA@mail.gmail.com>
References: <CA+FnnTyR9AoJx-3zuvgudeYmUTiNcfpAucUh0ZTcs=Ajy49qVA@mail.gmail.com>
<CAKFQuwZKp_FWZ0mi9H8th+fh70KeoV=4_6uB40TvQ9r1Q04UhA@mail.gmail.com>
David et al,
On Fri, Apr 25, 2025 at 10:48 PM David G. Johnston
<[email protected]> wrote:
>
> On Friday, April 25, 2025, Igor Korot <[email protected]> wrote:
>>
>>
>> for( int i = 0; i < PQntuples( res ); i++ )
>> {
>> auto temp1 = m_pimpl->m_myconv.from_bytes( PQgetvalue(
>> res, i, 1 ) );
>> m_tablespaces.push_back( temp1 );
>> } // this line gives a leak according to VLD
>> }
>> PQclear( res );
>> return result;
>> [/code]
>>
>> I ran this code on MSVC 2017 with VLD and according to the VLD report I have
>> a memory leak on the line indicated.
>
>
> Seems like a false positive.
Looks like it is false positive.
I ran the code under valgrind and there I didn't get
such a leak.
I did however get a different issues which I fixed.
But even after moving the fixes ober to Windows and trying
to run it - I still see that.
For now I put this to bed as it is not an issue on Linux.
Thank you.
>
>>
>>
>> Should I call PQclear() on every iteration of the loop?
>
>
> Would make processing more than a single row impossible if you throw away the result after processing one row.
>
> David J.
>
view thread (5+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: How to properly fix memory leak
In-Reply-To: <CA+FnnTxb=A9F4qw1oN6noatGC0UtE6OUgDe+K-J08YFUaOfJXQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox