Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j3omh-0001mt-1k for pgsql-bugs@arkaria.postgresql.org; Mon, 17 Feb 2020 22:22:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j3omf-0001FT-LH for pgsql-bugs@arkaria.postgresql.org; Mon, 17 Feb 2020 22:22:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j3omf-0001FL-D9 for pgsql-bugs@lists.postgresql.org; Mon, 17 Feb 2020 22:22:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j3omZ-0003WX-1B for pgsql-bugs@lists.postgresql.org; Mon, 17 Feb 2020 22:22:33 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 01HMMOuu024065; Mon, 17 Feb 2020 17:22:24 -0500 From: Tom Lane To: Hazuki Amamiya cc: "pgsql-bugs@lists.postgresql.org" Subject: Re: Possible memory leak in PostgreSQL 12.2 on truncate, insert or delete when type interval is involved In-reply-to: <26594723.3545403.1581955480512@mail.yahoo.com> References: <26594723.3545403.1581955480512.ref@mail.yahoo.com> <26594723.3545403.1581955480512@mail.yahoo.com> Comments: In-reply-to Hazuki Amamiya message dated "Mon, 17 Feb 2020 16:04:40 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <24063.1581978144.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 17 Feb 2020 17:22:24 -0500 Message-ID: <24064.1581978144@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hazuki Amamiya writes: > Recently, there is a memory leak in the game server I hosted. After chec= king the log, the leak seems appeared after I upgrade PostgreSQL from 11 t= o 12.1, and I have no luck even I upgraded the PostgreSQL to 12.2 [Postgre= SQL 12.2 (Debian 12.2-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc= (Debian 8.3.0-6) 8.3.0, 64-bit] in Debian 10. FWIW, I see no sign of a memory leak with this example. > While the script continuing to run, the RES (shown in command =E2=80=9Ct= op=E2=80=9D) will keep increasing forever. Does it really increase "forever"? A fairly common cause of confusion is that top will report the process' space consumption as gradually increasing until all of Postgres' shared buffers have been touched (after which the number stops growing). That's not a leak, it's just an artifact of how top chooses to count usage of shared memory. Usually, if you don't see the total "VIRT" column increasing, there's no real leak happening. regards, tom lane