Re: Assitance needed for the resolution of memory leak

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Assitance needed for the resolution of memory leak
Date: 2023-10-12 00:05:20
Message-ID: 6316561b-8dc5-c870-83d5-1efc9217178e@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

That's why you /attach/ files, not paste text.

On 10/11/23 16:19, Sasmit Utkarsh wrote:
> Thanks Tom, It did work, and yeah I do have indentation in my editor,
> there was some formatting issue due to the copy and paste of the code.
> :)
>
> Regards,
> Sasmit Utkarsh
> +91-7674022625
>
>
> On Thu, Oct 12, 2023 at 2:07 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Sasmit Utkarsh <utkarshsasmit(at)gmail(dot)com> writes:
> > Like for an ex: I have provided the test run for a file which has 4
> > duplicate entries in the input file and below is the leak reported.
> I have
> > followed
> > consistently using PQclear to free all PGresult objects.
>
> No you haven't: you've got two PQexec-something calls and
> only one PQclear.  If control reaches here:
>
> > res = PQexec(conn, Command);
>
> that will overwrite your only pointer to the PQexecParams
> result, and you won't clear it.
>
> BTW, if this is what your code actually looks like in your editor,
> it's no wonder you can't follow its basic control flow. Indent
> according to the brace structure, and your life will get easier.
>
>                         regards, tom lane
>

--
Born in Arizona, moved to Babylonia.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2023-10-12 00:14:41 Re: A question about possible recovery inconsistency
Previous Message Sasmit Utkarsh 2023-10-11 21:19:12 Re: Assitance needed for the resolution of memory leak