src/backend/utils/mmgr/mcxt.c
void
MemoryContextResetOnly(MemoryContext context)
{
	AssertArg(MemoryContextIsValid(context));

	/* Nothing to do if no pallocs since startup or last reset */
	if (!context->isReset)
	{
		MemoryContextCallResetCallbacks(context);

		/*
		 * If context->ident points into the context's memory, it will become
		 * a dangling pointer.  We could prevent that by setting it to NULL
		 * here, but that would break valid coding patterns that keep the
		 * ident elsewhere, e.g. in a parent context.  Another idea is to use
		 * MemoryContextContains(), but we don't require ident strings to be
		 * in separately-palloc'd chunks, so that risks false positives.  So
		 * for now we assume the programmer got it right.
		 */

		context->methods->reset(context);
		context->isReset = true;
		VALGRIND_DESTROY_MEMPOOL(context);
		VALGRIND_CREATE_MEMPOOL(context, 0, false);
	}
}
/*
 * MemoryContextResetOnly
 *		Release all space allocated within a context.
 *		Nothing is done to the context's descendant contexts.
 */
MemoryContextResetOnly
Release all space allocated within a context.
Nothing is done to the context's descendant contexts.
MemoryContextResetOnly Release all space allocated within a context . Nothing is done to the context ' s descendant contexts .
void
MemoryContextResetOnly(MemoryContext context)
{
	AssertArg(MemoryContextIsValid(context));
	if (!context->isReset)
	{
		MemoryContextCallResetCallbacks(context);
		context->methods->reset(context);
		context->isReset = true;
		VALGRIND_DESTROY_MEMPOOL(context);
		VALGRIND_CREATE_MEMPOOL(context, 0, false);
	}
}
void MemoryContextResetOnly ( MemoryContext context ) { AssertArg ( MemoryContextIsValid ( context ) ) ; if ( ! context -> isReset ) { MemoryContextCallResetCallbacks ( context ) ; context -> methods -> reset ( context ) ; context -> isReset = true ; VALGRIND_DESTROY_MEMPOOL ( context ) ; VALGRIND_CREATE_MEMPOOL ( context , 0 , false ) ; } }
MemoryContextResetOnly
              Release all space allocated within a context.
MemoryContextResetOnly Release all space allocated within a context .
/* Nothing to do if no pallocs since startup or last reset */ /*
		 * If context->ident points into the context's memory, it will become
		 * a dangling pointer.  We could prevent that by setting it to NULL
		 * here, but that would break valid coding patterns that keep the
		 * ident elsewhere, e.g. in a parent context.  Another idea is to use
		 * MemoryContextContains(), but we don't require ident strings to be
		 * in separately-palloc'd chunks, so that risks false positives.  So
		 * for now we assume the programmer got it right.
		 */