зеркало из https://github.com/mozilla/pjs.git
Fix bug 62791 - realloc now does in-place realloc when it can. r=pinkerton, sr=beard
This commit is contained in:
Родитель
2a61173475
Коммит
d36f03df55
|
@ -615,6 +615,12 @@ void *malloc(size_t blockSize)
|
|||
static UInt32 sBlockID = 0;
|
||||
blockHeader->blockID = sBlockID++;
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
{
|
||||
DebugStr("\pAllocation failure");
|
||||
}
|
||||
#endif
|
||||
return newBlock;
|
||||
#else
|
||||
|
||||
|
@ -677,15 +683,15 @@ void* realloc(void* block, size_t newSize)
|
|||
switch (allocator->GetAllocatorType())
|
||||
{
|
||||
case nsMemAllocator::eAllocatorTypeFixed:
|
||||
((nsFixedSizeAllocator*)allocator)->AllocatorResizeBlock(block, newSize);
|
||||
newBlock = ((nsFixedSizeAllocator*)allocator)->AllocatorResizeBlock(block, newSize);
|
||||
break;
|
||||
|
||||
case nsMemAllocator::eAllocatorTypeSmall:
|
||||
((nsSmallHeapAllocator*)allocator)->AllocatorResizeBlock(block, newSize);
|
||||
newBlock = ((nsSmallHeapAllocator*)allocator)->AllocatorResizeBlock(block, newSize);
|
||||
break;
|
||||
|
||||
case nsMemAllocator::eAllocatorTypeLarge:
|
||||
((nsLargeHeapAllocator*)allocator)->AllocatorResizeBlock(block, newSize);
|
||||
newBlock = ((nsLargeHeapAllocator*)allocator)->AllocatorResizeBlock(block, newSize);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче