From 0c05d4e1796cf39c8bc2e9a5f32ac063c71d4240 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 26 Jan 2015 19:26:41 +0000 Subject: [PATCH] Core: TryRealloc improvement git-svn-id: svn://ultimatepp.org/upp/trunk@8101 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/lheap.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uppsrc/Core/lheap.cpp b/uppsrc/Core/lheap.cpp index 2e9169357..f99806cae 100644 --- a/uppsrc/Core/lheap.cpp +++ b/uppsrc/Core/lheap.cpp @@ -265,6 +265,8 @@ bool Heap::LTryRealloc(void *ptr, size_t newsize) } if(bh->heap != this) // if another thread's heap, do not bother to be smart return newsize <= bh->size; + if(bh->size >= newsize) + return true; LLOG("--- TryRealloc " << asString(bh->size)); Header *n = bh->Next(); if(n->free && newsize <= (size_t)n->size + (size_t)bh->size) {