/*
* AllocSetContext is our standard implementation of MemoryContext.
*
- * Note: header.isReset means there is nothing for AllocSetReset to do. This is
- * different from the aset being physically empty (empty blocks list) because
- * we may still have a keeper block. It's also different from the set being
- * logically empty, because we don't attempt to detect pfree'ing the last
- * active chunk.
+ * Note: header.isReset means there is nothing for AllocSetReset to do.
+ * This is different from the aset being physically empty (empty blocks list)
+ * because we may still have a keeper block. It's also different from the set
+ * being logically empty, because we don't attempt to detect pfree'ing the
+ * last active chunk.
*/
typedef struct AllocSetContext
{
AssertArg(MemoryContextIsValid(context));
MemoryContextDeleteChildren(context);
- (*context->methods->reset) (context);
+ MemoryContextReset(context);
}
/*
void *
MemoryContextAlloc(MemoryContext context, Size size)
{
- void *ret;
AssertArg(MemoryContextIsValid(context));
if (!AllocSizeIsValid(size))
elog(ERROR, "invalid memory alloc request size %lu",
(unsigned long) size);
- ret = (*context->methods->alloc) (context, size);
context->isReset = false;
- return ret;
+
+ return (*context->methods->alloc) (context, size);
}
/*
elog(ERROR, "invalid memory alloc request size %lu",
(unsigned long) size);
+ context->isReset = false;
+
ret = (*context->methods->alloc) (context, size);
MemSetAligned(ret, 0, size);
- context->isReset = false;
return ret;
}
elog(ERROR, "invalid memory alloc request size %lu",
(unsigned long) size);
+ context->isReset = false;
+
ret = (*context->methods->alloc) (context, size);
MemSetLoop(ret, 0, size);
- context->isReset = false;
return ret;
}