src/backend/utils/mmgr/mcxt.c
void *
repalloc(void *pointer, Size size)
{
	MemoryContext context = GetMemoryChunkContext(pointer);
	void	   *ret;

	if (!AllocSizeIsValid(size))
		elog(ERROR, "invalid memory alloc request size %zu", size);

	AssertNotInCriticalSection(context);

	/* isReset must be false already */
	Assert(!context->isReset);

	ret = context->methods->realloc(context, pointer, size);
	if (unlikely(ret == NULL))
	{
		MemoryContextStats(TopMemoryContext);
		ereport(ERROR,
				(errcode(ERRCODE_OUT_OF_MEMORY),
				 errmsg("out of memory"),
				 errdetail("Failed on request of size %zu in memory context \"%s\".",
						   size, context->name)));
	}

	VALGRIND_MEMPOOL_CHANGE(context, pointer, ret, size);

	return ret;
}
/*
 * repalloc
 *		Adjust the size of a previously allocated chunk.
 */
repalloc
Adjust the size of a previously allocated chunk.
repalloc Adjust the size of a previously allocated chunk .
void *
repalloc(void *pointer, Size size)
{
	MemoryContext context = GetMemoryChunkContext(pointer);
	void	   *ret;
	if (!AllocSizeIsValid(size))
		elog(ERROR, "invalid memory alloc request size %zu", size);
	AssertNotInCriticalSection(context);
	Assert(!context->isReset);
	ret = context->methods->realloc(context, pointer, size);
	if (unlikely(ret == NULL))
	{
		MemoryContextStats(TopMemoryContext);
		ereport(ERROR,
				(errcode(ERRCODE_OUT_OF_MEMORY),
				 errmsg("out of memory"),
				 errdetail("Failed on request of size %zu in memory context \"%s\".",
						   size, context->name)));
	}
	VALGRIND_MEMPOOL_CHANGE(context, pointer, ret, size);
	return ret;
}
void * repalloc ( void * pointer , Size size ) { MemoryContext context = GetMemoryChunkContext ( pointer ) ; void * ret ; if ( ! AllocSizeIsValid ( size ) ) elog ( ERROR , " " , size ) ; AssertNotInCriticalSection ( context ) ; Assert ( ! context -> isReset ) ; ret = context -> methods -> realloc ( context , pointer , size ) ; if ( unlikely ( ret == NULL ) ) { MemoryContextStats ( TopMemoryContext ) ; ereport ( ERROR , ( errcode ( ERRCODE_OUT_OF_MEMORY ) , errmsg ( " " ) , errdetail ( " \" \" " , size , context -> name ) ) ) ; } VALGRIND_MEMPOOL_CHANGE ( context , pointer , ret , size ) ; return ret ; }
repalloc
              Adjust the size of a previously allocated chunk.
repalloc Adjust the size of a previously allocated chunk .
/* isReset must be false already */