Feature #120 ยป gc_malloc_stats.diff
| include/ruby/intern.h (working copy) | ||
|---|---|---|
|
VALUE rb_gc_enable(void);
|
||
|
VALUE rb_gc_disable(void);
|
||
|
VALUE rb_gc_start(void);
|
||
|
size_t rb_gc_malloc_allocated_size(void);
|
||
|
size_t rb_gc_malloc_allocations(void);
|
||
|
/* hash.c */
|
||
|
void st_foreach_safe(struct st_table *, int (*)(ANYARGS), st_data_t);
|
||
|
void rb_hash_foreach(VALUE, int (*)(ANYARGS), VALUE);
|
||
| configure.in (working copy) | ||
|---|---|---|
|
fi
|
||
|
AC_SUBST(MANTYPE)
|
||
|
AC_ARG_ENABLE(gc-malloc-stats,
|
||
|
[ --enable-gc-malloc-stats enable GC.malloc_allocations and GC.malloc_allocated_size.],
|
||
|
[gc_malloc_stats=$enableval], [gc_malloc_stats=no])
|
||
|
if test $gc_malloc_stats = yes; then
|
||
|
AC_DEFINE(CALC_EXACT_MALLOC_SIZE)
|
||
|
fi
|
||
|
arch_hdrdir="${EXTOUT}/include/${arch}/ruby"
|
||
|
$MAKEDIRS "${arch_hdrdir}"
|
||
|
config_h="${arch_hdrdir}/config.h"
|
||
| gc.c (working copy) | ||
|---|---|---|
|
struct gc_list *next;
|
||
|
};
|
||
|
#ifndef CALC_EXACT_MALLOC_SIZE
|
||
|
#define CALC_EXACT_MALLOC_SIZE 0
|
||
|
#endif
|
||
|
typedef struct rb_objspace {
|
||
|
struct {
|
||
| ... | ... | |
|
static VALUE
|
||
|
gc_malloc_allocated_size(VALUE self)
|
||
|
{
|
||
|
return UINT2NUM((&rb_objspace)->malloc_params.allocated_size);
|
||
|
return UINT2NUM(rb_gc_malloc_allocated_size());
|
||
|
}
|
||
|
size_t
|
||
|
rb_gc_malloc_allocated_size(void)
|
||
|
{
|
||
|
return (&rb_objspace)->malloc_params.allocated_size;
|
||
|
}
|
||
|
/*
|
||
|
* call-seq:
|
||
|
* GC.malloc_allocations -> Integer
|
||
| ... | ... | |
|
static VALUE
|
||
|
gc_malloc_allocations(VALUE self)
|
||
|
{
|
||
|
return UINT2NUM((&rb_objspace)->malloc_params.allocations);
|
||
|
return UINT2NUM(rb_gc_malloc_allocations());
|
||
|
}
|
||
|
size_t
|
||
|
rb_gc_malloc_allocations(void)
|
||
|
{
|
||
|
return (&rb_objspace)->malloc_params.allocations;
|
||
|
}
|
||
|
#endif
|
||
|
/*
|
||