Re: replication slot stats memory bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: replication slot stats memory bug
Date: 2021-03-17 23:36:46
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> I saw a leak in pgstat_read_statsfiles(), more precisely:
> /* Allocate the space for replication slot statistics */
> replSlotStats = palloc0(max_replication_slots * sizeof(PgStat_ReplSlotStats));

Yeah, I just found that myself. I think your fix is good.

> But it seems like we just shouldn't allocate it dynamically at all?
> max_replication_slots doesn't change during postmaster lifetime, so it
> seems like it should just be allocated once?

Meh. I don't see a need to wire in such an assumption here.

regards, tom lane

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-03-18 00:26:56 Re: Getting better results from valgrind leak tracking
Previous Message Julien Rouhaud 2021-03-17 23:29:56 Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?