From e0058b61728438469898845be0a7afb73f2ebc86 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 21 Jul 1998 04:17:30 +0000 Subject: 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@via.ecp.fr --- src/include/libpq/be-fsstubs.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/include/libpq') diff --git a/src/include/libpq/be-fsstubs.h b/src/include/libpq/be-fsstubs.h index 507f2a9367..108869dac9 100644 --- a/src/include/libpq/be-fsstubs.h +++ b/src/include/libpq/be-fsstubs.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: be-fsstubs.h,v 1.5 1997/09/08 21:52:33 momjian Exp $ + * $Id: be-fsstubs.h,v 1.6 1998/07/21 04:17:26 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -37,4 +37,9 @@ extern int lo_unlink(Oid lobjId); extern struct varlena *loread(int fd, int len); extern int lowrite(int fd, struct varlena * wbuf); +/* + * Added for buffer leak prevention [ Pascal André ] + */ +extern void _lo_commit(void); + #endif /* BE_FSSTUBS_H */ -- cgit v1.2.1