mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: TryRealloc improvement
git-svn-id: svn://ultimatepp.org/upp/trunk@8101 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
6194385b7e
commit
0c05d4e179
1 changed files with 2 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue