Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0b885e2

Browse files
committed
Release allocated memory during AtAbort_Memory.
1 parenteb4d9f4 commit0b885e2

File tree

1 file changed

+35
-6
lines changed
  • src/backend/access/transam

1 file changed

+35
-6
lines changed

‎src/backend/access/transam/xact.c

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.34 1999/05/09 00:52:08 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.35 1999/05/13 00:34:57 tgl Exp $
1111
*
1212
* NOTES
1313
*Transaction aborts can now occur two ways:
@@ -690,13 +690,27 @@ AtCommit_Locks()
690690
staticvoid
691691
AtCommit_Memory()
692692
{
693+
Portalportal;
694+
MemoryContextportalContext;
695+
693696
/* ----------------
694-
*now that we're "out" of a transaction, have the
697+
*Release memory in the blank portal.
698+
* Since EndPortalAllocMode implicitly works on the current context,
699+
* first make real sure that the blank portal is the selected context.
700+
* (This is probably not necessary, but seems like a good idea...)
701+
* ----------------
702+
*/
703+
portal=GetPortalByName(NULL);
704+
portalContext= (MemoryContext)PortalGetHeapMemory(portal);
705+
MemoryContextSwitchTo(portalContext);
706+
EndPortalAllocMode();
707+
708+
/* ----------------
709+
*Now that we're "out" of a transaction, have the
695710
*system allocate things in the top memory context instead
696711
*of the blank portal memory context.
697712
* ----------------
698713
*/
699-
EndPortalAllocMode();
700714
MemoryContextSwitchTo(TopMemoryContext);
701715
}
702716

@@ -770,10 +784,25 @@ AtAbort_Locks()
770784
staticvoid
771785
AtAbort_Memory()
772786
{
787+
Portalportal;
788+
MemoryContextportalContext;
789+
790+
/* ----------------
791+
*Release memory in the blank portal.
792+
* Since EndPortalAllocMode implicitly works on the current context,
793+
* first make real sure that the blank portal is the selected context.
794+
* (This is ESSENTIAL in case we aborted from someplace where it wasn't.)
795+
* ----------------
796+
*/
797+
portal=GetPortalByName(NULL);
798+
portalContext= (MemoryContext)PortalGetHeapMemory(portal);
799+
MemoryContextSwitchTo(portalContext);
800+
EndPortalAllocMode();
801+
773802
/* ----------------
774-
*after doing an aborttransaction,make certain the
775-
*systemusesthe top memory contextrather then the
776-
*portal memory context (until the next transaction).
803+
*Now that we're "out" of atransaction,have the
804+
*systemallocate things inthe top memory contextinstead
805+
*of the blank portal memory context.
777806
* ----------------
778807
*/
779808
MemoryContextSwitchTo(TopMemoryContext);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp