Re: Small memory fixes for pg_createsubcriber
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Euler Taveira <euler@eulerto.com>
Cc: "ranier.vf@gmail.com" <ranier.vf@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-02-12T03:53:51Z
Lists: pgsql-hackers
On Tue, Feb 11, 2025 at 01:32:32PM -0300, Euler Taveira wrote: > There is no bug. They are the same behind the scenes. I'm fine changing it. It > is a new code and it wouldn't cause a lot of pain to backpatch patches in the > future. On consistency grounds, and as this is documented in fe-exec.c at the top of PQfreemem(), I can get behind the switch. > Even if the pg_createsubscriber aims to run in a small amount of time, hence, > it is fine to leak memory, the initial commit cleaned up all variables but a > subsequent commit 4867f8a555c apparently didn't. Although it is just a low > impact improvement, it is better to be strict and shut up SASTs. check_and_drop_existing_subscriptions() is called once per database in setup_subscriber(), and we are not going to have millions of them in this list. We don't usually care for such short-lived things, but as the original commit did the effort in d44032d01463, I don't see why we cannot do it here, either. -- Michael
Commits
-
pg_upgrade: Fix inconsistency in memory freeing
- 9ca2145b00fb 16.9 landed
- ee78823ff5f6 17.5 landed
- 2a083ab807db 18.0 landed
-
pg_amcheck: Fix inconsistency in memory freeing
- 35a591a0486f 14.18 landed
- ec741d48036a 15.13 landed
- 816149dc6bf9 16.9 landed
- f903d4da9276 17.5 landed
- 48e4ae9a0707 18.0 landed
-
Fix some inconsistencies with memory freeing in pg_createsubscriber
- ff6d9cfcb17e 17.4 landed
- 5b94e2753439 18.0 landed
-
Drop pre-existing subscriptions from the converted subscriber.
- 4867f8a555ce 18.0 cited