out_of_memory cleanup per Jon
svn: r16388
This commit is contained in:
parent
03a98ac66c
commit
7cf6ec0836
|
@ -183,8 +183,7 @@ void GC_set_collect_inform_callback(void (*func)(int major_gc, long pre_used, lo
|
|||
/*****************************************************************************/
|
||||
static void garbage_collect(NewGC*, int);
|
||||
|
||||
/* do not use the gc parameter or check if its NULL in the future */
|
||||
static void out_of_memory(NewGC* gc)
|
||||
static void out_of_memory()
|
||||
{
|
||||
if (GC_report_out_of_memory)
|
||||
GC_report_out_of_memory();
|
||||
|
@ -192,9 +191,13 @@ static void out_of_memory(NewGC* gc)
|
|||
abort();
|
||||
}
|
||||
|
||||
inline static void out_of_memory_gc(NewGC* gc) {
|
||||
out_of_memory();
|
||||
}
|
||||
|
||||
static void *ofm_malloc(size_t size) {
|
||||
void *ptr = malloc(size);
|
||||
if (!ptr) out_of_memory(NULL);
|
||||
if (!ptr) out_of_memory();
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
@ -227,7 +230,7 @@ inline static void check_used_against_max(NewGC *gc, size_t len)
|
|||
gc->used_pages -= delta;
|
||||
GC_out_of_memory();
|
||||
}
|
||||
out_of_memory(NULL);
|
||||
out_of_memory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +248,7 @@ static void *malloc_pages(NewGC *gc, size_t len, size_t alignment)
|
|||
void *ptr;
|
||||
check_used_against_max(gc, len);
|
||||
ptr = vm_malloc_pages(gc->vm, len, alignment, 0);
|
||||
if (!ptr) out_of_memory(NULL);
|
||||
if (!ptr) out_of_memory();
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
@ -254,7 +257,7 @@ static void *malloc_dirty_pages(NewGC *gc, size_t len, size_t alignment)
|
|||
void *ptr;
|
||||
check_used_against_max(gc, len);
|
||||
ptr = vm_malloc_pages(gc->vm, len, alignment, 1);
|
||||
if (!ptr) out_of_memory(NULL);
|
||||
if (!ptr) out_of_memory();
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
@ -3080,7 +3083,7 @@ static void garbage_collect(NewGC *gc, int force_full)
|
|||
/* we don't want the low-level allocator freaking because we've gone past
|
||||
half the available memory */
|
||||
gc->in_unsafe_allocation_mode = 1;
|
||||
gc->unsafe_allocation_abort = out_of_memory;
|
||||
gc->unsafe_allocation_abort = out_of_memory_gc;
|
||||
|
||||
TIME_INIT();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user