diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-03 23:13:57 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-03 23:13:57 +0000 |
| commit | b3b28ae106010e247a371a095141b6ccff2ae7d6 (patch) | |
| tree | 25bc39a12ae82aa0c2b5381453266287a55d0d6c | |
| parent | f094a50b78637ea5842ad933b5299bd2a146a823 (diff) | |
| download | ruby-b3b28ae106010e247a371a095141b6ccff2ae7d6.tar.gz ruby-b3b28ae106010e247a371a095141b6ccff2ae7d6.tar.xz ruby-b3b28ae106010e247a371a095141b6ccff2ae7d6.zip | |
* gc.c (count_objects): count TOTAL.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | gc.c | 6 |
2 files changed, 9 insertions, 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 @@ -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; |
