BUG #2422: Memory leak from Savepoints when using foreign keys

From: "Tim Baumgartner" <jongleur0815(at)gmx(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2422: Memory leak from Savepoints when using foreign keys
Date: 2006-05-05 10:09:26
Message-ID: 200605051009.k45A9QFF003750@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2422
Logged by: Tim Baumgartner
Email address: jongleur0815(at)gmx(dot)de
PostgreSQL version: 8.1.3
Operating system: 1. Win2000, 2. Suse 10.0, x86_64-unknown-linux-gnu,
compiled by GCC 4.0.2 20050901 (prerelease)
Description: Memory leak from Savepoints when using foreign keys
Details:

I noticed a memory leak during a long transaction with many savepoints. When
trying to build a short self-contained test case for it, I noticed that the
existence of foreign keys dramatically increases the problem.
When I run the statements below, memory usage of the server process
increases by about 1 MB per second.

BEGIN;
CREATE TABLE t1(pk INT PRIMARY KEY);
CREATE TABLE t2(fk INT, FOREIGN KEY(fk)
REFERENCES t1(pk));
INSERT INTO t1 VALUES(1);
// loop
SAVEPOINT x;
INSERT INTO t2 VALUES(1);
RELEASE x;
// end of loop
COMMIT;

Note:
If the first INSERT statement is repeated in the loop (the loop counter can
be used as the value), then the effect is even higher: about 3 MB per second
on my machine.

Thanks a lot for your fine work anyway!

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2006-05-05 12:22:59 Re: [BUGS] BUG #2401: spinlocks not available on amd64
Previous Message Sathiyaseelan 2006-05-05 07:02:01 BUG #2421: problem in installing postgres at last stage