|
7 | 7 | * |
8 | 8 | * |
9 | 9 | * 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 $ |
11 | 11 | * |
12 | 12 | * NOTES |
13 | 13 | *Transaction aborts can now occur two ways: |
@@ -690,13 +690,27 @@ AtCommit_Locks() |
690 | 690 | staticvoid |
691 | 691 | AtCommit_Memory() |
692 | 692 | { |
| 693 | +Portalportal; |
| 694 | +MemoryContextportalContext; |
| 695 | + |
693 | 696 | /* ---------------- |
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 |
695 | 710 | *system allocate things in the top memory context instead |
696 | 711 | *of the blank portal memory context. |
697 | 712 | * ---------------- |
698 | 713 | */ |
699 | | -EndPortalAllocMode(); |
700 | 714 | MemoryContextSwitchTo(TopMemoryContext); |
701 | 715 | } |
702 | 716 |
|
@@ -770,10 +784,25 @@ AtAbort_Locks() |
770 | 784 | staticvoid |
771 | 785 | AtAbort_Memory() |
772 | 786 | { |
| 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 | + |
773 | 802 | /* ---------------- |
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. |
777 | 806 | * ---------------- |
778 | 807 | */ |
779 | 808 | MemoryContextSwitchTo(TopMemoryContext); |
|