mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
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
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.20 1998/06/15 19:28:02 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.21 1998/07/21 04:17:21 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Transaction aborts can now occur two ways:
|
||||
@ -137,6 +137,11 @@
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Large object clean up added in CommitTransaction() to prevent buffer leaks.
|
||||
* [PA, 7/17/98]
|
||||
* [PA] is Pascal Andr<64> <andre@via.ecp.fr>
|
||||
*/
|
||||
#include <postgres.h>
|
||||
|
||||
#include <access/xact.h>
|
||||
@ -151,6 +156,9 @@
|
||||
#include <commands/async.h>
|
||||
#include <commands/sequence.h>
|
||||
|
||||
/* included for _lo_commit [PA, 7/17/98] */
|
||||
#include <libpq/be-fsstubs.h>
|
||||
|
||||
static void AbortTransaction(void);
|
||||
static void AtAbort_Cache(void);
|
||||
static void AtAbort_Locks(void);
|
||||
@ -889,6 +897,10 @@ CommitTransaction()
|
||||
* do commit processing
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
/* handle commit for large objects [ PA, 7/17/98 ] */
|
||||
_lo_commit();
|
||||
|
||||
CloseSequences();
|
||||
DestroyTempRels();
|
||||
AtEOXact_portals();
|
||||
|
Reference in New Issue
Block a user