diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | gc.c | 8 | ||||
-rw-r--r-- | internal.h | 2 |
4 files changed, 16 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Tue Dec 3 23:48:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * configure.in: check malloc_size() available on BSD. + + * gc.c: use malloc_size() with malloc/malloc.h on BSD. + Tue Dec 3 23:06:20 2013 Narihiro Nakamura <authornari@gmail.com> * object.c (rb_obj_clone): don't copy FL_WB_PROTECTED of a diff --git a/configure.in b/configure.in index 8bff18d6dd..88d24eefe8 100644 --- a/configure.in +++ b/configure.in @@ -1093,6 +1093,7 @@ AC_CHECK_HEADERS( \ atomic.h \ malloc.h \ malloc_np.h \ + malloc/malloc.h \ setjmpex.h ) @@ -1870,6 +1871,7 @@ AC_CHECK_FUNCS(lockf) AC_CHECK_FUNCS(log2) AC_CHECK_FUNCS(lstat) AC_CHECK_FUNCS(malloc_usable_size) +AC_CHECK_FUNCS(malloc_size) AC_CHECK_FUNCS(mblen) AC_CHECK_FUNCS(memalign) AC_CHECK_FUNCS(memrchr) @@ -39,12 +39,18 @@ # ifdef _WIN32 # define HAVE_MALLOC_USABLE_SIZE # define malloc_usable_size(a) _msize(a) +# elif defined HAVE_MALLOC_SIZE +# define HAVE_MALLOC_USABLE_SIZE +# define malloc_usable_size(a) malloc_size(a) # endif -#else +#endif +#ifdef HAVE_MALLOC_USABLE_SIZE # ifdef HAVE_MALLOC_H # include <malloc.h> # elif defined(HAVE_MALLOC_NP_H) # include <malloc_np.h> +# elif defined(HAVE_MALLOC_MALLOC_H) +# include <malloc/malloc.h> # endif #endif diff --git a/internal.h b/internal.h index 810159d313..0e47e8db0a 100644 --- a/internal.h +++ b/internal.h @@ -455,7 +455,7 @@ void rb_objspace_set_event_hook(const rb_event_flag_t event); void rb_gc_writebarrier_remember_promoted(VALUE obj); void ruby_gc_set_params(void); -#if HAVE_MALLOC_USABLE_SIZE || defined(_WIN32) +#if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32) #define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size) #define ruby_sized_xfree(ptr, size) ruby_xfree(ptr) #define SIZED_REALLOC_N(var,type,n,old_n) REALLOC_N(var, type, n) |