diff options
author | ivmai <ivmai> | 2009-09-10 18:24:52 +0000 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2011-07-26 21:06:46 +0400 |
commit | 20031fb436cf204632124aaa66c73f2972d533ab (patch) | |
tree | 41592057ae3a55bdc20cf66cd403a51e58c35a4f /mallocx.c | |
parent | eae86e9ece3225f1008453220aa8492858e624ec (diff) | |
download | bdwgc-20031fb436cf204632124aaa66c73f2972d533ab.tar.gz |
2009-09-10 Ivan Maidanski <ivmai@mail.ru>
(diff115)
* finalize.c (GC_general_register_disappearing_link,
GC_register_finalizer_inner): Remove unnecessary "ifdef THREADS"
guard for LOCK/UNLOCK().
* finalize.c (GC_general_register_disappearing_link,
GC_register_finalizer_inner): Get GC_oom_fn value before releasing
the lock (to prevent data races).
* gcj_mlc.c (GC_gcj_malloc, GC_debug_gcj_malloc,
GC_gcj_malloc_ignore_off_page): Ditto.
* mallocx.c (GC_generic_malloc_ignore_off_page): Ditto.
* include/gc_inline.h (GC_FAST_MALLOC_GRANS): Use GC_get_oom_fn()
instead of GC_oom_fn (to prevent data races).
* malloc.c (GC_generic_malloc): Ditto.
* mallocx.c (GC_memalign): Ditto.
* pthread_support.c (pthread_create): Ditto.
* gcj_mlc.c (maybe_finalize): Acquire the lock before setting
last_finalized_no value to prevent data races.
* include/gc.h (GC_gc_no, GC_get_gc_no, GC_oom_fn, GC_set_oom_fn,
GC_set_find_leak, GC_set_finalize_on_demand,
GC_set_java_finalization, GC_set_finalizer_notifier,
GC_set_dont_expand, GC_set_full_freq, GC_set_non_gc_bytes,
GC_set_no_dls, GC_set_free_space_divisor, GC_set_max_retries,
GC_set_dont_precollect, GC_set_time_limit, GC_warn_proc): Refine
the comment.
* misc.c (GC_set_oom_fn): Ditto.
* include/gc.h (GC_general_register_disappearing_link): Refine the
comment (replace "soft" word with "weak").
* misc.c (GC_oom_fn, GC_get_gc_no, GC_get_parallel,
GC_set_finalizer_notifier, GC_set_find_leak): Add the comment.
* misc.c (GC_set_oom_fn, GC_get_oom_fn, GC_set_finalizer_notifier,
GC_get_finalizer_notifier): Use LOCK/UNLOCK to prevent data races.
Diffstat (limited to 'mallocx.c')
-rw-r--r-- | mallocx.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -198,10 +198,12 @@ void * GC_generic_malloc_ignore_off_page(size_t lb, int k) } } GC_bytes_allocd += lb_rounded; - UNLOCK(); if (0 == result) { - return((*GC_oom_fn)(lb)); + GC_oom_func oom_fn = GC_oom_fn; + UNLOCK(); + return((*oom_fn)(lb)); } else { + UNLOCK(); if (init && !GC_debugging_started) { BZERO(result, n_blocks * HBLKSIZE); } @@ -500,7 +502,9 @@ GC_API void * GC_CALL GC_memalign(size_t align, size_t lb) if (align <= GRANULE_BYTES) return GC_malloc(lb); if (align >= HBLKSIZE/2 || lb >= HBLKSIZE/2) { - if (align > HBLKSIZE) return GC_oom_fn(LONG_MAX-1024) /* Fail */; + if (align > HBLKSIZE) { + return (*GC_get_oom_fn())(LONG_MAX-1024); /* Fail */ + } return GC_malloc(lb <= HBLKSIZE? HBLKSIZE : lb); /* Will be HBLKSIZE aligned. */ } |