Re: BUG #18624: Memory Leak Issue with PostgreSQL Connection During COPY Command Execution.

From: Andres Freund <andres(at)anarazel(dot)de>
To: abhmittal(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18624: Memory Leak Issue with PostgreSQL Connection During COPY Command Execution.
Date: 2024-09-20 18:29:13
Message-ID: p3wmyj7cllclyxgebcqilds5f25yfuyozwerel4no54k5oro6f@ly5ivt67icfb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Noah Misch 2024-09-20 19:07:31 Re: vacuumdb: permission denied for schema "pg_temp_7"
Previous Message Tom Lane 2024-09-20 17:55:02 Re: BUG #18624: Memory Leak Issue with PostgreSQL Connection During COPY Command Execution.