提交 33e89ae4 编写于 作者: Y Yuan Zhao 提交者: Adam Lee

Fix memory allocation error when request size is near MaxAllocSize

palloc and repalloc will check request size is under MaxAllocSize,
but the implementation(AllocSetAllocImpl, AllocSetReallocImpl) allocs
ALLOC_BLOCKHDRSZ + ALLOC_CHUNKHDRSZ more bytes to store block
information. Later MemoryContextNoteAlloc is called with block size.
If palloc request size is between MaxAllocSize - (ALLOC_BLOCKHDRSZ +
ALLOC_CHUNKHDRSZ) and MaxAllocSize, an internal error occurs.

Fix: simply remove those assertions, the calculations in
MemoryContextNoteAlloc and MemoryContextNoteFree should work with larger
values.

This resolves https://github.com/greenplum-db/gpdb/issues/1090.
Signed-off-by: NPeifeng Qiu <pqiu@pivotal.io>
Signed-off-by: NYuan Zhao <yuzhao@pivotal.io>
上级 743027c7
......@@ -362,7 +362,6 @@ MemoryContextNoteAlloc(MemoryContext context, Size nbytes)
Size held;
AssertArg(MemoryContextIsValid(context));
AssertArg(AllocSizeIsValid(nbytes));
for (;;)
{
......@@ -394,7 +393,6 @@ MemoryContextNoteFree(MemoryContext context, Size nbytes)
Size held;
AssertArg(MemoryContextIsValid(context));
AssertArg(AllocSizeIsValid(nbytes));
while (context)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册