Commit 4b980167 authored by Tom Lane's avatar Tom Lane

Report memory context stats upon out-of-memory in repalloc[_huge].

This longstanding functionality evidently got lost in commit
3d6d1b58.  Noted while studying an OOM report from Jaime
Casanova.  Backpatch to 9.5 where the bug was introduced.
parent ab737f6b
......@@ -1051,10 +1051,13 @@ repalloc(void *pointer, Size size)
ret = (*context->methods->realloc) (context, pointer, 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_CHANGE(context, pointer, ret, size);
......@@ -1131,10 +1134,13 @@ repalloc_huge(void *pointer, Size size)
ret = (*context->methods->realloc) (context, pointer, 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_CHANGE(context, pointer, ret, size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment