mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Release allocated memory during AtAbort_Memory.
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.34 1999/05/09 00:52:08 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.35 1999/05/13 00:34:57 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* Transaction aborts can now occur two ways:
|
* Transaction aborts can now occur two ways:
|
||||||
@ -690,13 +690,27 @@ AtCommit_Locks()
|
|||||||
static void
|
static void
|
||||||
AtCommit_Memory()
|
AtCommit_Memory()
|
||||||
{
|
{
|
||||||
|
Portal portal;
|
||||||
|
MemoryContext portalContext;
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* now that we're "out" of a transaction, have the
|
* Release memory in the blank portal.
|
||||||
|
* Since EndPortalAllocMode implicitly works on the current context,
|
||||||
|
* first make real sure that the blank portal is the selected context.
|
||||||
|
* (This is probably not necessary, but seems like a good idea...)
|
||||||
|
* ----------------
|
||||||
|
*/
|
||||||
|
portal = GetPortalByName(NULL);
|
||||||
|
portalContext = (MemoryContext) PortalGetHeapMemory(portal);
|
||||||
|
MemoryContextSwitchTo(portalContext);
|
||||||
|
EndPortalAllocMode();
|
||||||
|
|
||||||
|
/* ----------------
|
||||||
|
* Now that we're "out" of a transaction, have the
|
||||||
* system allocate things in the top memory context instead
|
* system allocate things in the top memory context instead
|
||||||
* of the blank portal memory context.
|
* of the blank portal memory context.
|
||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
EndPortalAllocMode();
|
|
||||||
MemoryContextSwitchTo(TopMemoryContext);
|
MemoryContextSwitchTo(TopMemoryContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -770,10 +784,25 @@ AtAbort_Locks()
|
|||||||
static void
|
static void
|
||||||
AtAbort_Memory()
|
AtAbort_Memory()
|
||||||
{
|
{
|
||||||
|
Portal portal;
|
||||||
|
MemoryContext portalContext;
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* after doing an abort transaction, make certain the
|
* Release memory in the blank portal.
|
||||||
* system uses the top memory context rather then the
|
* Since EndPortalAllocMode implicitly works on the current context,
|
||||||
* portal memory context (until the next transaction).
|
* first make real sure that the blank portal is the selected context.
|
||||||
|
* (This is ESSENTIAL in case we aborted from someplace where it wasn't.)
|
||||||
|
* ----------------
|
||||||
|
*/
|
||||||
|
portal = GetPortalByName(NULL);
|
||||||
|
portalContext = (MemoryContext) PortalGetHeapMemory(portal);
|
||||||
|
MemoryContextSwitchTo(portalContext);
|
||||||
|
EndPortalAllocMode();
|
||||||
|
|
||||||
|
/* ----------------
|
||||||
|
* Now that we're "out" of a transaction, have the
|
||||||
|
* system allocate things in the top memory context instead
|
||||||
|
* of the blank portal memory context.
|
||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
MemoryContextSwitchTo(TopMemoryContext);
|
MemoryContextSwitchTo(TopMemoryContext);
|
||||||
|
Reference in New Issue
Block a user