mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
gc.c: use malloc_size
* configure.in: check malloc_size() available on BSD. * gc.c: use malloc_size() with malloc/malloc.h on BSD. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7e1f3c636b
commit
b7c6db94ae
4 changed files with 16 additions and 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
|
||||
|
|
|
@ -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)
|
||||
|
|
8
gc.c
8
gc.c
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue