Re: Can SET_VARSIZE cause a memory leak?

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: "??????? ??????????" <nb(at)cobra(dot)ru>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Can SET_VARSIZE cause a memory leak?
Date: 2016-06-09 01:43:53
Message-ID: CAB7nPqTvn+zubS4uVRajUBnPO2O9auYK91_BrhF1_Ns6HA-cGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jun 8, 2016 at 9:55 PM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> wrote:
> This is safe, and the memory will be freed at the end of the transaction.

Yes, palloc takes memory from the current memory context. The case
where you would need to use pfree is if there is an allocation
continuously done within the same code paths for a reason or another
that may result in a leak if this code path is taken repeatedly and
that the memory used is wasted out.
--
Michael

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Patrick B 2016-06-09 01:47:12 Re: Automate copy - Postgres 9.2
Previous Message Michael Paquier 2016-06-09 01:39:35 Re: Unregistered OpenSSL callbacks access violation