Re: BUG #18624: Memory Leak Issue with PostgreSQL Connection During COPY Command Execution. - Mailing list pgsql-bugs

From Andres Freund
Subject Re: BUG #18624: Memory Leak Issue with PostgreSQL Connection During COPY Command Execution.
Date
Msg-id p3wmyj7cllclyxgebcqilds5f25yfuyozwerel4no54k5oro6f@ly5ivt67icfb
Whole thread Raw
In response to BUG #18624: Memory Leak Issue with PostgreSQL Connection During COPY Command Execution.  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
Hi,

On 2024-09-19 07:30:54 +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      18624
> Logged by:          Abhishek Mittal
> Email address:      abhmittal@gmail.com
> PostgreSQL version: 12.16
> Operating system:   ubuntu0.20.04.1
> Description:        

> 4. We observe that the RES (resident) memory reported by the top command
> continuously increases. This memory increase only occurs when we run queries
> on this connection. If no queries are executed, the RES memory remains
> stable.

I suspect what you may be seeing is that RES is increased the first time a
backend references a shared memory page, unless huge page are used. Because
you're copying more and more data in, more and more of shared buffers are
going to be used.

Do you see RES increasing to something substantially larger than
shared_buffers?

You can query the different aspects making up RES by doing
grep Rss /proc/$PID/status

which will return something like:

RssAnon:        3364 kB
RssFile:       11196 kB
RssShmem:     2204444 kB

Where only RssAnon really is memory usage.

FWIW, this was for a pid that was doing lots of COPYs and where top showed a
memory usage of 2GB.

Greetings,

Andres Freund



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18624: Memory Leak Issue with PostgreSQL Connection During COPY Command Execution.
Next
From: Noah Misch
Date:
Subject: Re: vacuumdb: permission denied for schema "pg_temp_7"