AtCommit_Memory()
{
Portal portal;
- MemoryContext portalContext;
/* ----------------
- * 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...)
+ * Release all heap memory in the blank portal.
* ----------------
*/
portal = GetPortalByName(NULL);
- portalContext = (MemoryContext) PortalGetHeapMemory(portal);
- MemoryContextSwitchTo(portalContext);
- EndPortalAllocMode();
+ PortalResetHeapMemory(portal);
/* ----------------
* Now that we're "out" of a transaction, have the
AtAbort_Memory()
{
Portal portal;
- MemoryContext portalContext;
/* ----------------
- * 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 ESSENTIAL in case we aborted from someplace where it wasn't.)
+ * Release all heap memory in the blank portal.
* ----------------
*/
portal = GetPortalByName(NULL);
- portalContext = (MemoryContext) PortalGetHeapMemory(portal);
- MemoryContextSwitchTo(portalContext);
- EndPortalAllocMode();
+ PortalResetHeapMemory(portal);
/* ----------------
* Now that we're "out" of a transaction, have the
static void CollectNamedPortals(Portal *portalP, int destroy);
static Portal PortalHeapMemoryGetPortal(PortalHeapMemory context);
static PortalVariableMemory PortalHeapMemoryGetVariableMemory(PortalHeapMemory context);
-static void PortalResetHeapMemory(Portal portal);
static Portal PortalVariableMemoryGetPortal(PortalVariableMemory context);
/* ----------------
* BadArg if mode is invalid.
* ----------------
*/
-static void
+void
PortalResetHeapMemory(Portal portal)
{
PortalHeapMemory context;
extern void PortalDestroy(Portal *portalP);
extern void StartPortalAllocMode(AllocMode mode, Size limit);
extern void EndPortalAllocMode(void);
+extern void PortalResetHeapMemory(Portal portal);
extern PortalVariableMemory PortalGetVariableMemory(Portal portal);
extern PortalHeapMemory PortalGetHeapMemory(Portal portal);