From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Igor Korot <ikorot01(at)gmail(dot)com> |
Cc: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: How to properly fix memory leak |
Date: | 2025-04-26 03:48:00 |
Message-ID: | CAKFQuwZKp_FWZ0mi9H8th+fh70KeoV=4_6uB40TvQ9r1Q04UhA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Friday, April 25, 2025, Igor Korot <ikorot01(at)gmail(dot)com> 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.
>
> 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Igor Korot | 2025-04-26 04:17:17 | Re: How to properly fix memory leak |
Previous Message | Igor Korot | 2025-04-26 03:24:49 | How to properly fix memory leak |