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@arinc.com
www.rockwellcollins.com