mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 14:46:02 +00:00
Fix bug 62791 - realloc now does in-place realloc when it can. r=pinkerton, sr=beard
This commit is contained in:
parent
f09d25e85c
commit
24c2721346
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user