Commit deb21f0f authored by Tom Lane's avatar Tom Lane

Log memory context stats to stderr when reporting a 'Memory exhausted'

error, so as to provide a starting point for debugging.
parent e69b8d46
......@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.35 2000/12/05 23:40:36 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.36 2001/01/06 21:59:39 tgl Exp $
*
* NOTE:
* This is a new (Feb. 05, 1999) implementation of the allocation set
......@@ -324,7 +324,10 @@ AllocSetContextCreate(MemoryContext parent,
block = (AllocBlock) malloc(blksize);
if (block == NULL)
{
MemoryContextStats(TopMemoryContext);
elog(ERROR, "Memory exhausted in AllocSetContextCreate()");
}
block->aset = context;
block->freeptr = ((char *) block) + ALLOC_BLOCKHDRSZ;
block->endptr = ((char *) block) + blksize;
......@@ -482,7 +485,10 @@ AllocSetAlloc(MemoryContext context, Size size)
blksize = chunk_size + ALLOC_BLOCKHDRSZ + ALLOC_CHUNKHDRSZ;
block = (AllocBlock) malloc(blksize);
if (block == NULL)
{
MemoryContextStats(TopMemoryContext);
elog(ERROR, "Memory exhausted in AllocSetAlloc()");
}
block->aset = set;
block->freeptr = block->endptr = ((char *) block) + blksize;
......@@ -673,7 +679,10 @@ AllocSetAlloc(MemoryContext context, Size size)
}
if (block == NULL)
{
MemoryContextStats(TopMemoryContext);
elog(ERROR, "Memory exhausted in AllocSetAlloc()");
}
block->aset = set;
block->freeptr = ((char *) block) + ALLOC_BLOCKHDRSZ;
......@@ -843,7 +852,10 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
blksize = chksize + ALLOC_BLOCKHDRSZ + ALLOC_CHUNKHDRSZ;
block = (AllocBlock) realloc(block, blksize);
if (block == NULL)
{
MemoryContextStats(TopMemoryContext);
elog(ERROR, "Memory exhausted in AllocSetReAlloc()");
}
block->freeptr = block->endptr = ((char *) block) + blksize;
/* Update pointers since block has likely been moved */
......
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