Re: replication slot stats memory bug - Mailing list pgsql-hackers

From Tom Lane
Subject Re: replication slot stats memory bug
Date
Msg-id 3654384.1616024206@sss.pgh.pa.us
Whole thread Raw
In response to replication slot stats memory bug  (Andres Freund <andres@anarazel.de>)
Responses Re: replication slot stats memory bug  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.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



pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?
Next
From: Andres Freund
Date:
Subject: Re: Getting better results from valgrind leak tracking