From: | Junwang Zhao <zhjwpku(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: [PATCH v1] fix potential memory leak in untransformRelOptions |
Date: | 2022-09-01 23:08:44 |
Message-ID: | CAEG8a3+4YxWn10kpmvmdxv7Ga6O1Hhm89Y2+TWN=La6xcBs4jg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
got it, thanks.
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>于2022年9月2日 周五01:13写道:
> Junwang Zhao <zhjwpku(at)gmail(dot)com> writes:
> > I'm a little confused when we should call *pfree* and when we should not.
> > A few lines before there is a call *text_to_cstring* in which it invokes
> > *pfree* to free the unpacked text [0]. I'm just thinking that since *s*
> has
> > been duplicated, we should free it, that's where the patch comes from.
>
> By and large, the server is designed so that small memory leaks don't
> matter: the space will be reclaimed when the current memory context
> is deleted, and most code runs in reasonably short-lived contexts.
> Individually pfree'ing such allocations is actually a net negative,
> because it costs cycles and code space.
>
> There are places where a leak *does* matter, but unless you can
> demonstrate that this is one, it's not worth changing.
>
> regards, tom lane
>
--
Regards
Junwang Zhao
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-09-01 23:08:49 | Re: postgres_fdw hint messages |
Previous Message | Nathan Bossart | 2022-09-01 22:31:28 | Re: postgres_fdw hint messages |