Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit68bc848

Browse files
committed
Tweak out-of-memory error messages to include the request size, so that
it's easier to tell whether a bug report is talking about progressivememory exhaustion or a wacko requested chunk size.
1 parent184fb14 commit68bc848

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

‎src/backend/utils/mmgr/aset.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1994, Regents of the University of California
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.39 2001/01/24 19:43:16 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.40 2001/03/19 22:29:39 tgl Exp $
1515
*
1616
* NOTE:
1717
*This is a new (Feb. 05, 1999) implementation of the allocation set
@@ -326,7 +326,8 @@ AllocSetContextCreate(MemoryContext parent,
326326
if (block==NULL)
327327
{
328328
MemoryContextStats(TopMemoryContext);
329-
elog(ERROR,"Memory exhausted in AllocSetContextCreate()");
329+
elog(ERROR,"Memory exhausted in AllocSetContextCreate(%lu)",
330+
(unsigned long)minContextSize);
330331
}
331332
block->aset=context;
332333
block->freeptr= ((char*)block)+ALLOC_BLOCKHDRSZ;
@@ -487,7 +488,8 @@ AllocSetAlloc(MemoryContext context, Size size)
487488
if (block==NULL)
488489
{
489490
MemoryContextStats(TopMemoryContext);
490-
elog(ERROR,"Memory exhausted in AllocSetAlloc()");
491+
elog(ERROR,"Memory exhausted in AllocSetAlloc(%lu)",
492+
(unsigned long)size);
491493
}
492494
block->aset=set;
493495
block->freeptr=block->endptr= ((char*)block)+blksize;
@@ -682,7 +684,8 @@ AllocSetAlloc(MemoryContext context, Size size)
682684
if (block==NULL)
683685
{
684686
MemoryContextStats(TopMemoryContext);
685-
elog(ERROR,"Memory exhausted in AllocSetAlloc()");
687+
elog(ERROR,"Memory exhausted in AllocSetAlloc(%lu)",
688+
(unsigned long)size);
686689
}
687690

688691
block->aset=set;
@@ -751,7 +754,8 @@ AllocSetFree(MemoryContext context, void *pointer)
751754
block=block->next;
752755
}
753756
if (block==NULL)
754-
elog(ERROR,"AllocSetFree: cannot find block containing chunk");
757+
elog(ERROR,"AllocSetFree: cannot find block containing chunk %p",
758+
chunk);
755759
/* let's just make sure chunk is the only one in the block */
756760
Assert(block->freeptr== ((char*)block)+
757761
(chunk->size+ALLOC_BLOCKHDRSZ+ALLOC_CHUNKHDRSZ));
@@ -844,7 +848,8 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
844848
block=block->next;
845849
}
846850
if (block==NULL)
847-
elog(ERROR,"AllocSetRealloc: cannot find block containing chunk");
851+
elog(ERROR,"AllocSetRealloc: cannot find block containing chunk %p",
852+
chunk);
848853
/* let's just make sure chunk is the only one in the block */
849854
Assert(block->freeptr== ((char*)block)+
850855
(chunk->size+ALLOC_BLOCKHDRSZ+ALLOC_CHUNKHDRSZ));
@@ -856,7 +861,8 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size)
856861
if (block==NULL)
857862
{
858863
MemoryContextStats(TopMemoryContext);
859-
elog(ERROR,"Memory exhausted in AllocSetReAlloc()");
864+
elog(ERROR,"Memory exhausted in AllocSetReAlloc(%lu)",
865+
(unsigned long)size);
860866
}
861867
block->freeptr=block->endptr= ((char*)block)+blksize;
862868

@@ -1012,7 +1018,7 @@ AllocSetCheck(MemoryContext context)
10121018
if (!blk_used)
10131019
{
10141020
if (set->keeper!=block)
1015-
elog(NOTICE,"AllocSetCheck(): %s: empty block %p",
1021+
elog(NOTICE,"AllocSetCheck: %s: empty block %p",
10161022
name,block);
10171023
}
10181024

@@ -1034,16 +1040,16 @@ AllocSetCheck(MemoryContext context)
10341040
* Check chunk size
10351041
*/
10361042
if (dsize>chsize)
1037-
elog(NOTICE,"AllocSetCheck(): %s: req size > alloc size for chunk %p in block %p",
1043+
elog(NOTICE,"AllocSetCheck: %s: req size > alloc size for chunk %p in block %p",
10381044
name,chunk,block);
10391045
if (chsize< (1 <<ALLOC_MINBITS))
1040-
elog(NOTICE,"AllocSetCheck(): %s: bad size %lu for chunk %p in block %p",
1046+
elog(NOTICE,"AllocSetCheck: %s: bad size %lu for chunk %p in block %p",
10411047
name, (unsigned long)chsize,chunk,block);
10421048

10431049
/* single-chunk block? */
10441050
if (chsize>ALLOC_CHUNK_LIMIT&&
10451051
chsize+ALLOC_CHUNKHDRSZ!=blk_used)
1046-
elog(NOTICE,"AllocSetCheck(): %s: bad single-chunk %p in block %p",
1052+
elog(NOTICE,"AllocSetCheck: %s: bad single-chunk %p in block %p",
10471053
name,chunk,block);
10481054

10491055
/*
@@ -1052,14 +1058,14 @@ AllocSetCheck(MemoryContext context)
10521058
* can't check as easily...)
10531059
*/
10541060
if (dsize>0&&chunk->aset!= (void*)set)
1055-
elog(NOTICE,"AllocSetCheck(): %s: bogus aset link in block %p, chunk %p",
1061+
elog(NOTICE,"AllocSetCheck: %s: bogus aset link in block %p, chunk %p",
10561062
name,block,chunk);
10571063

10581064
/*
10591065
* Check for overwrite of "unallocated" space in chunk
10601066
*/
10611067
if (dsize>0&&dsize<chsize&&*chdata_end!=0x7E)
1062-
elog(NOTICE,"AllocSetCheck(): %s: detected write past chunk end in block %p, chunk %p",
1068+
elog(NOTICE,"AllocSetCheck: %s: detected write past chunk end in block %p, chunk %p",
10631069
name,block,chunk);
10641070

10651071
blk_data+=chsize;
@@ -1069,7 +1075,7 @@ AllocSetCheck(MemoryContext context)
10691075
}
10701076

10711077
if ((blk_data+ (nchunks*ALLOC_CHUNKHDRSZ))!=blk_used)
1072-
elog(NOTICE,"AllocSetCheck(): %s: found inconsistent memory block %p",
1078+
elog(NOTICE,"AllocSetCheck: %s: found inconsistent memory block %p",
10731079
name,block);
10741080
}
10751081
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp