Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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!

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group