Re: Memory leak with CREATE TEMP TABLE ON COMMIT DROP? - Mailing list pgsql-general

From Tom Lane
Subject Re: Memory leak with CREATE TEMP TABLE ON COMMIT DROP?
Date
Msg-id 30781.1402622822@sss.pgh.pa.us
Whole thread Raw
In response to Memory leak with CREATE TEMP TABLE ON COMMIT DROP?  (Eric Ridge <e_ridge@tcdi.com>)
List pgsql-general
Eric Ridge <e_ridge@tcdi.com> writes:
> As best I can guess, Postgres has some kind of memory leak around (at least) temporary tables flagged to drop on
commit. It's fairly easy to reproduce: 

I don't see any memory leak with this example.

What I do see is the process's use of shared memory grows slowly until it
reaches 128MB (or whatever you've set shared_buffers to), and then stops.
This is normal behavior and has nothing to do with any memory leak: what
causes that is that top and related tools typically don't count shared
memory pages in a process's memory footprint until the process has
actually touched those pages.  So as the process gradually touches more
and more of the shared buffers, its memory usage appears to climb, but
that's completely an illusion of the viewing tool.  The important point
is the process's private memory usage, and that's not growing at all
AFAICS --- it's steady at a small number of megabytes.

Since you say you had an out-of-memory failure, you may well have had
some kind of leak in your original situation, but this test case isn't
reproducing it.

            regards, tom lane


pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: what does pg_activity mean when the database is stuck?
Next
From: Kevin Grittner
Date:
Subject: Re: max_connections reached in postgres 9.3.3