diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c index 2bfd364..2845089 100644 --- a/src/backend/utils/mmgr/mcxt.c +++ b/src/backend/utils/mmgr/mcxt.c @@ -788,26 +788,7 @@ MemoryContextAllocZero(MemoryContext context, Size size) { void *ret; - AssertArg(MemoryContextIsValid(context)); - AssertNotInCriticalSection(context); - - if (!AllocSizeIsValid(size)) - elog(ERROR, "invalid memory alloc request size %zu", size); - - context->isReset = false; - - ret = (*context->methods->alloc) (context, size); - if (ret == NULL) - { - MemoryContextStats(TopMemoryContext); - ereport(ERROR, - (errcode(ERRCODE_OUT_OF_MEMORY), - errmsg("out of memory"), - errdetail("Failed on request of size %zu.", size))); - } - - VALGRIND_MEMPOOL_ALLOC(context, ret, size); - + ret = MemoryContextAlloc(context, size); MemSetAligned(ret, 0, size); return ret; @@ -825,26 +806,7 @@ MemoryContextAllocZeroAligned(MemoryContext context, Size size) { void *ret; - AssertArg(MemoryContextIsValid(context)); - AssertNotInCriticalSection(context); - - if (!AllocSizeIsValid(size)) - elog(ERROR, "invalid memory alloc request size %zu", size); - - context->isReset = false; - - ret = (*context->methods->alloc) (context, size); - if (ret == NULL) - { - MemoryContextStats(TopMemoryContext); - ereport(ERROR, - (errcode(ERRCODE_OUT_OF_MEMORY), - errmsg("out of memory"), - errdetail("Failed on request of size %zu.", size))); - } - - VALGRIND_MEMPOOL_ALLOC(context, ret, size); - + ret = MemoryContextAlloc(context, size); MemSetLoop(ret, 0, size); return ret;