mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c (count_objects): count TOTAL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
19c4d26c51
commit
4cdcfbe2ba
2 changed files with 9 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
Sun Nov 4 08:11:19 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* gc.c (count_objects): count TOTAL.
|
||||
|
||||
Sun Nov 4 03:58:32 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* string.c (tr_setup_table): use C array for characters that fit
|
||||
|
|
6
gc.c
6
gc.c
|
@ -2155,7 +2155,8 @@ rb_obj_id(VALUE obj)
|
|||
*
|
||||
* Counts objects for each type.
|
||||
*
|
||||
* It returns a hash as: {:FREE=>3012, :T_OBJECT=>6, :T_CLASS=>404, ...}
|
||||
* It returns a hash as:
|
||||
* {:TOTAL=>10000, :FREE=>3011, :T_OBJECT=>6, :T_CLASS=>404, ...}
|
||||
*
|
||||
* If the optional argument, result_hash, is given,
|
||||
* it is overwritten and returned.
|
||||
|
@ -2173,6 +2174,7 @@ count_objects(int argc, VALUE *argv, VALUE os)
|
|||
{
|
||||
long counts[T_MASK+1];
|
||||
long freed = 0;
|
||||
long total = 0;
|
||||
int i;
|
||||
VALUE hash;
|
||||
|
||||
|
@ -2197,10 +2199,12 @@ count_objects(int argc, VALUE *argv, VALUE os)
|
|||
freed++;
|
||||
}
|
||||
}
|
||||
total += heaps[i].limit;
|
||||
}
|
||||
|
||||
if (hash == Qnil)
|
||||
hash = rb_hash_new();
|
||||
rb_hash_aset(hash, ID2SYM(rb_intern("TOTAL")), LONG2NUM(total));
|
||||
rb_hash_aset(hash, ID2SYM(rb_intern("FREE")), LONG2NUM(freed));
|
||||
for (i = 0; i <= T_MASK; i++) {
|
||||
VALUE type;
|
||||
|
|
Loading…
Reference in a new issue