Memory leak with PL/Python trigger

From: "Behn, Edward (EBEHN)" <EBEHN(at)arinc(dot)com>
To: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Memory leak with PL/Python trigger
Date: 2015-07-30 23:15:05
Message-ID: 93F16B4BD93A7840AC75EB16E9494C7B211084DA@EXANPMB1.arinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I believe that I have discovered a memory leak bug that affects PostgreSQL
9.5 Alpha -1. (It also affects 9.4.1.)

The leak appears in the server process when a PL/Python trigger function is
used to populate a composite type that contains a field that is a domain
type. This leak is worse if the domain type has a constraint.

The attached files create a database that has this property (Schema.sql) and
add rows to the table causing the leak (Test.py).

If the trigger function is implemented in PL/pgSQL, the leak disappears.

After 1,000,000 rows, the server process has a memory footprint of 544 MiB
(~570 bytes/row) if the constraint is present on the domain type.

After 1,000,000 rows, the server process has a memory footprint of 144 MiB
(~150 bytes/row) if the constraint is not present on the domain type.

I am running PostgreSQL 9.5 Alpha-1 on Fedora 21. My installation is "out of
the box" from the YUM repository. I have not altered any configuration
files. I have tested the code as user/role postgres.

-Ed Behn

Ed Behn / Staff Engineer / Airline and Network Services
Information Management Services
2551 Riva Road, Annapolis, MD 21401 USA
Phone: 410.266.4426 / Cell: 240.696.7443
ebehn(at)arinc(dot)com
<http://www.rockwellcollins.com/> www.rockwellcollins.com

Attachment Content-Type Size
Schema.sql text/plain 775 bytes
Test.py text/plain 570 bytes
smime.p7s application/pkcs7-signature 10.2 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Haribabu Kommi 2015-07-31 02:13:15 Re: Memory leak with PL/Python trigger
Previous Message Peter J. Holzer 2015-07-30 21:30:29 Re: Segfault in pg_stat_activity