BUG #4996: postgres.exe memory consumption keeps going up - Mailing list pgsql-bugs

From Shivesh Wangrungvichaisri
Subject BUG #4996: postgres.exe memory consumption keeps going up
Date
Msg-id 200908191550.n7JFoiJv019149@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4996: postgres.exe memory consumption keeps going up  (Craig Ringer <craig@postnewspapers.com.au>)
Re: BUG #4996: postgres.exe memory consumption keeps going up  (Greg Stark <gsstark@mit.edu>)
Re: BUG #4996: postgres.exe memory consumption keeps going up  (Craig Ringer <craig@postnewspapers.com.au>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4996
Logged by:          Shivesh Wangrungvichaisri
Email address:      sbw@appsig.com
PostgreSQL version: 8.3.7
Operating system:   Windows XP x64 / Windows 7 x64
Description:        postgres.exe memory consumption keeps going up
Details:

Application: C++
Connector: libpq that came with 8.3.7
Problem: postgres.exe memory consumption keeps going up. (Working set and
Sharable as viewed from Windows Task Manager)
Steps to reproduce problem:
1) Create a test table
2) Using a C++ program, create 2 threads.
3) First thread will keep doing an INSERT of anything.
4) Second thread will keep doing a SELECT of anything.
5) Do NOT call PQfinish on PGconn. Rather, keep the connection opened after
each query is finished.
6) PGresult, of course, should be PQClear after every query.
7) Look in Windows Task manager. Since there were 2 threads that opened the
connection, there will be 2 postgres.exe whose memory consumption keeps
going up slowly.
8) In our real application, since we INSERT a large amount of data per
query, as well as SELECT a large amount of data per query, the memory leak
is much worse, and postgres.exe crashes after its memory consumption has
reached about 1.8GB.

Reference:
 - What our command line looks like:

http://picasaweb.google.com/shivesh/PostgresqlCommandLine#537169872221980512
2
 - Example code that should demonstrate the problem:
http://stackoverflow.com/questions/1280513/posgressql-memory-leaque (note we
use Intel TBB to launch threads..you can use whatever thread library you
want.)

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #4993: memory issue with array_agg
Next
From: Magnus Hagander
Date:
Subject: Re: BUG #4961: pg_standby.exe crashes with no args