Re: Memory leak in WAL sender with pgoutput (v10~)

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Memory leak in WAL sender with pgoutput (v10~)
Date: 2024-12-10 04:11:43
Message-ID: Z1e_f8WOgbEdDTHp@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 10, 2024 at 03:24:19AM +0000, vignesh C wrote:
> Yes, that makes sense. How about something like the attached patch.

So you have this bit hidden in 7f481b8d3884, causing a small conflict
when cherry-picking the change from 15 to 14:

- oldctx = MemoryContextSwitchTo(CacheMemoryContext);
- if (data->publications)
- list_free_deep(data->publications);
+ static MemoryContext pubctx = NULL;
[...]
- if (data->publications)
- {
- list_free_deep(data->publications);
- data->publications = NIL;
- }
+ static MemoryContext pubctx = NULL;

Your versions look OK at quick glance, for the publication list
caching.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2024-12-10 04:47:02 Re: Track the amount of time waiting due to cost_delay
Previous Message Andrey M. Borodin 2024-12-10 03:50:23 Re: testing framework for MVCC & vacuum (freeze) & heap_page_prune etc.