Large Objects buffer leak patch(es)

From: <andre(at)via(dot)ecp(dot)fr>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Large Objects buffer leak patch(es)
Date: 1998-07-20 09:30:41
Message-ID: Pine.LNX.3.96.980720105603.7677B-300000@Chimay
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi all.

As nobody answered my previous post, I decided to correct PostgreSQL
buffer leaks caused by large objects methods.

Theses buffer leaks are caused by indexes that are kept open between
calls. Outside a transaction, the backend detects them as buffer leaks; it
sends a NOTICE, and frees them. This sometimes cause a segmentation fault
(at least on Linux). These indexes are initialized on the first
lo_read/lo_write/lo_tell call, and (normally) closed on a lo_close call.
Thus the buffer leaks appear when lo direct access functions are used, and
not with lo_import/lo_export functions (libpq version calls lo_close
before ending the command, and the backend version uses another path).

The included patches (against recent snapshot, and against 6.3.2) cause
indexes to be closed on transaction end (that is on explicit 'END'
statment, or on command termination outside trasaction blocks), thus
preventing the buffer leaks while increasing performance inside
transactions. Some (all?) 'classic' memory leaks are also removed.

I hope it will be ok.

---
Pascal ANDRE, graduated from Ecole Centrale Paris
andre(at)via(dot)ecp(dot)fr
"Use the source, Luke. Be one with the Code." -- Linus Torvalds

Attachment Content-Type Size
patch-snapshot.diff text/plain 6.5 KB
patch-6.3.2.diff text/plain 7.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-07-20 09:37:14 Re: [HACKERS] Name type vs. char *
Previous Message Maarten Boekhold 1998-07-20 07:07:34 Re: [GENERAL] Recalling previous commands at the PSQL prompt