Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Defines | Functions

# ext/objspace/objspace.c File Reference

`#include <ruby/ruby.h>`
`#include <ruby/st.h>`
`#include <ruby/io.h>`
`#include <ruby/re.h>`
`#include <../../node.h>`
Include dependency graph for objspace.c:

Go to the source code of this file.

## Defines
#define | COUNT_TYPE(t) case t: type = ID2SYM(rb_intern(#t)); break;
#define | COUNT_NODE(n) case n: node = ID2SYM(rb_intern(#n)); break;
## Functions
size_t | rb_str_memsize (VALUE)
size_t | rb_ary_memsize (VALUE)
size_t | rb_io_memsize (rb_io_t *)
size_t | onig_memsize (regex_t *)
size_t | rb_generic_ivar_memsize (VALUE)
size_t | rb_objspace_data_type_memsize (VALUE obj)
void | rb_objspace_each_objects (int(*callback)(void *start, void *end, size_t stride, void *data), void *data)
static size_t | memsize_of (VALUE obj)
static VALUE | memsize_of_m (VALUE self, VALUE obj)
static int | set_zero_i (st_data_t key, st_data_t val, st_data_t arg)
static int | cos_i (void *vstart, void *vend, size_t stride, void *data)
static VALUE | count_objects_size (int argc, VALUE *argv, VALUE os)
static int | cn_i (void *vstart, void *vend, size_t stride, void *n)
static VALUE | count_nodes (int argc, VALUE *argv, VALUE os)
static int | cto_i (void *vstart, void *vend, size_t stride, void *data)
static VALUE | count_tdata_objects (int argc, VALUE *argv, VALUE self)
void | Init_objspace (void)

## Define Documentation

#define COUNT_NODE | ( |  | n | ) | case n: node = ID2SYM(rb_intern(#n)); break;

Referenced by count_nodes().

#define COUNT_TYPE | ( |  | t | ) | case t: type = ID2SYM(rb_intern(#t)); break;

Referenced by count_objects(), and count_objects_size().

## Function Documentation

static int cn_i | ( | void * | vstart,
|  | void * | vend,
|  | size_t | stride,
|  | void * | n
| ) |  | `[static]`

Definition at line 288 of file objspace.c.

References BUILTIN_TYPE, nd_type, RBASIC, and T_NODE.

Referenced by count_nodes().

static int cos_i | ( | void * | vstart,
|  | void * | vend,
|  | size_t | stride,
|  | void * | data
| ) |  | `[static]`

Definition at line 184 of file objspace.c.

References BUILTIN_TYPE, memsize_of(), and RBASIC.

Referenced by count_objects_size().

static VALUE count_nodes | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | os
| ) |  | `[static]`

Definition at line 326 of file objspace.c.

References cn_i(), COUNT_NODE, hash(), INT2FIX, NODE_ALIAS, NODE_ALLOCA, NODE_AND, NODE_ARGS, NODE_ARGS_AUX, NODE_ARGSCAT, NODE_ARGSPUSH, NODE_ARRAY, NODE_ATTRASGN, NODE_BACK_REF, NODE_BEGIN, NODE_BLOCK, NODE_BLOCK_ARG, NODE_BLOCK_PASS, NODE_BMETHOD, NODE_BREAK, NODE_CALL, NODE_CASE, NODE_CDECL, NODE_CLASS, NODE_COLON2, NODE_COLON3, NODE_CONST, NODE_CVAR, NODE_CVASGN, NODE_CVDECL, NODE_DASGN, NODE_DASGN_CURR, NODE_DEFINED, NODE_DEFN, NODE_DEFS, NODE_DOT2, NODE_DOT3, NODE_DREGX, NODE_DREGX_ONCE, NODE_DSTR, NODE_DSYM, NODE_DVAR, NODE_DXSTR, NODE_ENSURE, NODE_ERRINFO, NODE_EVSTR, NODE_FALSE, NODE_FCALL, NODE_FLIP2, NODE_FLIP3, NODE_FOR, NODE_GASGN, NODE_GVAR, NODE_HASH, NODE_IASGN, NODE_IASGN2, NODE_IF, NODE_IFUNC, NODE_ITER, NODE_IVAR, NODE_LAMBDA, NODE_LASGN, NODE_LAST, NODE_LIT, NODE_LVAR, NODE_MASGN, NODE_MATCH, NODE_MATCH2, NODE_MATCH3, NODE_MEMO, NODE_MODULE, NODE_NEXT, NODE_NIL, NODE_NTH_REF, NODE_OP_ASGN1, NODE_OP_ASGN2, NODE_OP_ASGN_AND, NODE_OP_ASGN_OR, NODE_OPT_ARG, NODE_OPT_N, NODE_OPTBLOCK, NODE_OR, NODE_POSTARG, NODE_POSTEXE, NODE_PRELUDE, NODE_REDO, NODE_RESBODY, NODE_RESCUE, NODE_RETRY, NODE_RETURN, NODE_SCLASS, NODE_SCOPE, NODE_SELF, NODE_SPLAT, NODE_STR, NODE_SUPER, NODE_TO_ARY, NODE_TRUE, NODE_UNDEF, NODE_UNTIL, NODE_VALIAS, NODE_VALUES, NODE_VCALL, NODE_WHEN, NODE_WHILE, NODE_XSTR, NODE_YIELD, NODE_ZARRAY, NODE_ZSUPER, Qnil, rb_eTypeError, rb_hash_aset(), rb_hash_new(), rb_objspace_each_objects(), rb_raise(), rb_scan_args(), RHASH_EMPTY_P, RHASH_TBL, set_zero_i(), SIZET2NUM, st_foreach, T_HASH, and TYPE.

Referenced by Init_objspace().

static VALUE count_objects_size | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | os
| ) |  | `[static]`

Definition at line 221 of file objspace.c.

References cos_i(), COUNT_TYPE, hash(), ID2SYM, INT2NUM(), Qnil, rb_eTypeError, rb_hash_aset(), rb_hash_new(), rb_intern, rb_objspace_each_objects(), rb_raise(), rb_scan_args(), RHASH_EMPTY_P, RHASH_TBL, set_zero_i(), SIZET2NUM, st_foreach, T_ARRAY, T_BIGNUM, T_CLASS, T_COMPLEX, T_DATA, T_FALSE, T_FILE, T_FIXNUM, T_FLOAT, T_HASH, T_ICLASS, T_MASK, T_MATCH, T_MODULE, T_NIL, T_NODE, T_NONE, T_OBJECT, T_RATIONAL, T_REGEXP, T_STRING, T_STRUCT, T_SYMBOL, T_TRUE, T_UNDEF, T_ZOMBIE, type, and TYPE.

Referenced by Init_objspace().

static VALUE count_tdata_objects | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  | `[static]`

Definition at line 514 of file objspace.c.

References cto_i(), hash(), Qnil, rb_eTypeError, rb_hash_new(), rb_objspace_each_objects(), rb_raise(), rb_scan_args(), RHASH_EMPTY_P, RHASH_TBL, set_zero_i(), st_foreach, T_HASH, and TYPE.

Referenced by Init_objspace().

static int cto_i | ( | void * | vstart,
|  | void * | vend,
|  | size_t | stride,
|  | void * | data
| ) |  | `[static]`

Definition at line 469 of file objspace.c.

References BUILTIN_TYPE, FIX2INT, hash(), INT2FIX, NIL_P, rb_hash_aref(), rb_hash_aset(), RBASIC, and T_DATA.

Referenced by count_tdata_objects().

void Init_objspace | ( | void |  | ) |

Definition at line 546 of file objspace.c.

References count_nodes(), count_objects_size(), count_tdata_objects(), memsize_of_m(), rb_cObject, rb_const_get(), rb_define_module_function(), and rb_intern.

static size_t memsize_of | ( | VALUE | obj | ) | `[static]`

Definition at line 44 of file objspace.c.

References BDIGIT, BUILTIN_TYPE, rmatch::char_offset_num_allocated, FL_EXIVAR, FL_TEST, nd_type, NODE_ALLOCA, NODE_SCOPE, onig_memsize(), rb_ary_memsize(), rb_bug(), rb_generic_ivar_memsize(), rb_io_memsize(), rb_objspace_data_type_memsize(), rb_str_memsize(), RBASIC, RBIGNUM_DIGITS, RBIGNUM_EMBED_FLAG, RBIGNUM_LEN, RCLASS, RCLASS_IV_INDEX_TBL, RCLASS_IV_TBL, RCLASS_M_TBL, RFILE, RHASH, RMATCH, RNODE, ROBJECT, ROBJECT_EMBED, RREGEXP, RSTRUCT, RSTRUCT_EMBED_LEN_MASK, RSTRUCT_LEN, size, SPECIAL_CONST_P, st_memsize(), T_ARRAY, T_BIGNUM, T_CLASS, T_COMPLEX, T_DATA, T_FILE, T_FLOAT, T_HASH, T_ICLASS, T_MATCH, T_MODULE, T_NODE, T_OBJECT, T_RATIONAL, T_REGEXP, T_STRING, T_STRUCT, and T_ZOMBIE.

Referenced by cos_i(), and memsize_of_m().

static VALUE memsize_of_m | ( | VALUE | self,
|  | VALUE | obj
| ) |  | `[static]`

Definition at line 169 of file objspace.c.

References memsize_of(), and SIZET2NUM.

Referenced by Init_objspace().

size_t onig_memsize | ( | regex_t * |  | ) |

Definition at line 5236 of file regcomp.c.

References re_pattern_buffer::alloc, re_pattern_buffer::chain, re_pattern_buffer::exact, re_pattern_buffer::exact_end, if(), re_pattern_buffer::int_map, re_pattern_buffer::int_map_backward, IS_NOT_NULL, ONIG_CHAR_TABLE_SIZE, onig_memsize(), re_pattern_buffer::p, re_pattern_buffer::repeat_range, re_pattern_buffer::repeat_range_alloc, and size.

Referenced by memsize_of(), and onig_memsize().

size_t rb_ary_memsize | ( | VALUE |  | ) |

Definition at line 390 of file array.c.

References ARY_OWNS_HEAP_P, and RARRAY.

Referenced by memsize_of().

size_t rb_generic_ivar_memsize | ( | VALUE |  | ) |

Definition at line 948 of file variable.c.

References st_lookup, and st_memsize().

Referenced by memsize_of().

size_t rb_io_memsize | ( | rb_io_t * |  | ) |

Definition at line 3552 of file io.c.

References rb_io_t::cbuf_capa, rb_econv_memsize(), rb_io_t::rbuf_capa, rb_io_t::readconv, size, rb_io_t::wbuf_capa, and rb_io_t::writeconv.

Referenced by memsize_of().

size_t rb_objspace_data_type_memsize | ( | VALUE | obj | ) |

Definition at line 1146 of file gc.c.

References RTYPEDDATA_DATA, RTYPEDDATA_P, and RTYPEDDATA_TYPE.

Referenced by memsize_of().

void rb_objspace_each_objects | ( | int(*)(void *start, void *end, size_t stride, void *data) | callback,
|  | void * | data
| ) |  |

Referenced by count_nodes(), count_objects_size(), count_tdata_objects(), and os_obj_of().

size_t rb_str_memsize | ( | VALUE |  | ) |

Definition at line 785 of file string.c.

References RSTRING, STR_EMBED_P, and STR_SHARED_P.

Referenced by memsize_of().

static int set_zero_i | ( | st_data_t | key,
|  | st_data_t | val,
|  | st_data_t | arg
| ) |  | `[static]`

Definition at line 175 of file objspace.c.

References hash(), INT2FIX, rb_hash_aset(), and ST_CONTINUE.

Referenced by count_nodes(), count_objects_size(), and count_tdata_objects().