corrections to GC out-of-memory handling
This commit is contained in:
parent
cffb63be56
commit
db40c2f4ce
|
@ -222,7 +222,7 @@ static void *alloc_cache_alloc_page(AllocCacheBlock *blockfree, size_t len, siz
|
|||
/* attempt to allocate from OS */
|
||||
size_t extra = (alignment ? (alignment + CACHE_SEED_PAGES * APAGE_SIZE) : 0);
|
||||
r = os_alloc_pages(len + extra);
|
||||
if(r == (void *)-1) { return NULL; }
|
||||
if(!r) { return NULL; }
|
||||
|
||||
if (alignment) {
|
||||
/* We allocated too large so we can choose the alignment. */
|
||||
|
|
|
@ -181,6 +181,8 @@ static void *os_alloc_pages(size_t len)
|
|||
|
||||
retval = vm_allocate(task_self, (vm_address_t*)&r, len, TRUE);
|
||||
if(retval != KERN_SUCCESS) {
|
||||
if (retval == KERN_NO_SPACE)
|
||||
return NULL;
|
||||
GCPRINT(GCOUTF, "Couldn't allocate memory: %s\n", mach_error_string(retval));
|
||||
abort();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user