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);
|
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()
|
||||||
static void out_of_memory(NewGC* gc)
|
|
||||||
{
|
{
|
||||||
if (GC_report_out_of_memory)
|
if (GC_report_out_of_memory)
|
||||||
GC_report_out_of_memory();
|
GC_report_out_of_memory();
|
||||||
|
@ -192,9 +191,13 @@ static void out_of_memory(NewGC* gc)
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline static void out_of_memory_gc(NewGC* gc) {
|
||||||
|
out_of_memory();
|
||||||
|
}
|
||||||
|
|
||||||
static void *ofm_malloc(size_t size) {
|
static void *ofm_malloc(size_t size) {
|
||||||
void *ptr = malloc(size);
|
void *ptr = malloc(size);
|
||||||
if (!ptr) out_of_memory(NULL);
|
if (!ptr) out_of_memory();
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +230,7 @@ inline static void check_used_against_max(NewGC *gc, size_t len)
|
||||||
gc->used_pages -= delta;
|
gc->used_pages -= delta;
|
||||||
GC_out_of_memory();
|
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;
|
void *ptr;
|
||||||
check_used_against_max(gc, len);
|
check_used_against_max(gc, len);
|
||||||
ptr = vm_malloc_pages(gc->vm, len, alignment, 0);
|
ptr = vm_malloc_pages(gc->vm, len, alignment, 0);
|
||||||
if (!ptr) out_of_memory(NULL);
|
if (!ptr) out_of_memory();
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +257,7 @@ static void *malloc_dirty_pages(NewGC *gc, size_t len, size_t alignment)
|
||||||
void *ptr;
|
void *ptr;
|
||||||
check_used_against_max(gc, len);
|
check_used_against_max(gc, len);
|
||||||
ptr = vm_malloc_pages(gc->vm, len, alignment, 1);
|
ptr = vm_malloc_pages(gc->vm, len, alignment, 1);
|
||||||
if (!ptr) out_of_memory(NULL);
|
if (!ptr) out_of_memory();
|
||||||
return ptr;
|
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
|
/* we don't want the low-level allocator freaking because we've gone past
|
||||||
half the available memory */
|
half the available memory */
|
||||||
gc->in_unsafe_allocation_mode = 1;
|
gc->in_unsafe_allocation_mode = 1;
|
||||||
gc->unsafe_allocation_abort = out_of_memory;
|
gc->unsafe_allocation_abort = out_of_memory_gc;
|
||||||
|
|
||||||
TIME_INIT();
|
TIME_INIT();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user