aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-03-13 00:21:07 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2016-03-13 00:21:07 -0500
commit4b980167cb5a489346c5e53afb86280a7d59ebc7 (patch)
treeb5801e2df577975fb140defa2fa1630a5cc8a487 /src/backend/utils
parentab737f6ba9fc0a26d32a95b115d5cd0e24a63191 (diff)
downloadpostgresql-4b980167cb5a489346c5e53afb86280a7d59ebc7.tar.gz
postgresql-4b980167cb5a489346c5e53afb86280a7d59ebc7.zip
Report memory context stats upon out-of-memory in repalloc[_huge].
This longstanding functionality evidently got lost in commit 3d6d1b585524aab6. Noted while studying an OOM report from Jaime Casanova. Backpatch to 9.5 where the bug was introduced.
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/mmgr/mcxt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index 2bfd364336b..6b7894213c1 100644
--- a/src/backend/utils/mmgr/mcxt.c
+++ b/src/backend/utils/mmgr/mcxt.c
@@ -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);