From: | Dmitry Igrishin <dmitigr(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Is it memory leak or not? |
Date: | 2020-02-10 16:18:19 |
Message-ID: | CAAfz9KOevZx=G7kArs68jCRG61hp=uYZT=fL2A+k3=Gx3cgaTw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, 10 Feb 2020, 18:59 Tom Lane, <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Dmitry Igrishin <dmitigr(at)gmail(dot)com> writes:
> > Maybe I'm wrong, but anychar_typmodin() of
> > src/backend/utils/adt/varchar.c of PostgreSQL 12.1 does not pfree()s
> > the memory allocated by ArrayGetIntegerTypmods(). Probably, I'm
> > missing something. Could anybody please clarify on that?
>
> It is a leak, in the sense that the pointer is unreferenced once the
> function returns. But we don't care, either here or in the probably
> thousands of other similar cases, because we don't expect this function
> to be run in a long-lived memory context. The general philosophy in
> the backend is that it's cheaper and far less error-prone to rely on
> memory context cleanup to reclaim (small amounts of) memory than to
> rely on manual pfree calls. You can read more about that in
> src/backend/utils/mmgr/README.
>
I see. Thank you very much!
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Bapat | 2020-02-10 16:22:40 | Re: [PATCH] Erase the distinctClause if the result is unique by definition |
Previous Message | Tom Lane | 2020-02-10 15:59:19 | Re: Is it memory leak or not? |