mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
when GC_DEBUG is off, try to use GC_malloc_ignore_off_page for large blocks. Since GC_MALLOC always returns cleared blocks, don't bother clearning. r=gordon, bug=15906
This commit is contained in:
parent
37e611148b
commit
3a3f6560c9
@ -27,7 +27,14 @@
|
||||
void *malloc(size_t blockSize)
|
||||
//--------------------------------------------------------------------
|
||||
{
|
||||
#ifdef GC_DEBUG
|
||||
return GC_MALLOC(blockSize);
|
||||
#else
|
||||
if (blockSize <= 10000)
|
||||
return GC_MALLOC(blockSize);
|
||||
else
|
||||
return GC_malloc_ignore_off_page(blockSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -71,9 +78,7 @@ void* realloc(void* block, size_t newSize)
|
||||
void *calloc(size_t nele, size_t elesize)
|
||||
//--------------------------------------------------------------------
|
||||
{
|
||||
size_t space = nele * elesize;
|
||||
void *newBlock = malloc(space);
|
||||
if (newBlock)
|
||||
memset(newBlock, 0, space);
|
||||
return newBlock;
|
||||
// GC_MALLOC returns cleared blocks for us.
|
||||
size_t space = nele * elesize;
|
||||
return GC_MALLOC(space);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user