Re: Thinko in pgstat_build_snapshot()

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Thinko in pgstat_build_snapshot()
Date: 2025-03-30 11:30:43
Message-ID: df2dc0d0-7d46-4a51-9f36-a6f79cd4ece5@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 30/03/2025 13:23, Etsuro Fujita wrote:
> While working on something else I noticed $SUBJECT: we are allocating
> more memory than necessary and copying more data than necessary
> because we specify the wrong PgStat_KindInfo member as the size
> argument for MemoryContextAlloc and memcpy. This could become
> problematic if snapshotting a very large number of variables stats, so
> I fixed it. Attached is a patch for that.

Good catch. Patch looks good to me at quick glance.

--
Heikki Linnakangas
Neon (https://neon.tech)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tender Wang 2025-03-30 11:31:25 Re: Typo in comment for pgstat_database_flush_cb()
Previous Message Etsuro Fujita 2025-03-30 10:28:07 Typo in comment for pgstat_database_flush_cb()