[前][次][番号順一覧][スレッド一覧]

ruby-changes:38222

From: zzak <ko1@a...>
Date: Tue, 14 Apr 2015 09:01:37 +0900 (JST)
Subject: [ruby-changes:38222] zzak:r50303 (trunk): * gc.c: [DOC] Improve documentation for ObjectSpace.count_objects

zzak	2015-04-14 09:01:03 +0900 (Tue, 14 Apr 2015)

  New Revision: 50303

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50303

  Log:
    * gc.c: [DOC] Improve documentation for ObjectSpace.count_objects
      with regards to `:TOTAL` key, with patch by @schneems [Fixes GH-871]
      https://github.com/ruby/ruby/pull/871 [Bug #11067] [ci skip]

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50302)
+++ ChangeLog	(revision 50303)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Apr 14 08:59:04 2015  Zachary Scott  <e@z...>
+
+        * gc.c: [DOC] Improve documentation for ObjectSpace.count_objects
+          with regards to `:TOTAL` key, with patch by @schneems [Fixes GH-871]
+          https://github.com/ruby/ruby/pull/871 [Bug #11067]
+
 Mon Apr 13 22:44:07 2015  Tanaka Akira  <akr@f...>
 
 	* test/lib/envutil.rb (File.mkfifo): Defined using mkfifo command.
Index: gc.c
===================================================================
--- gc.c	(revision 50302)
+++ gc.c	(revision 50303)
@@ -3056,7 +3056,7 @@ set_zero(st_data_t key, st_data_t val, s https://github.com/ruby/ruby/blob/trunk/gc.c#L3056
  *  call-seq:
  *     ObjectSpace.count_objects([result_hash]) -> hash
  *
- *  Counts objects for each type.
+ *  Counts all objects grouped by type.
  *
  *  It returns a hash, such as:
  *	{
@@ -3068,11 +3068,17 @@ set_zero(st_data_t key, st_data_t val, s https://github.com/ruby/ruby/blob/trunk/gc.c#L3068
  *	}
  *
  *  The contents of the returned hash are implementation specific.
- *  It may be changed in future.
+ *  It may be changed in future. The +:TOTAL+ key contains the count
+ *  of all currently allocated and previously freed objects.
  *
  *  If the optional argument +result_hash+ is given,
  *  it is overwritten and returned. This is intended to avoid probe effect.
  *
+ *    h = {}
+ *    ObjectSpace.count_objects(h)
+ *    puts h
+ *    # => { :TOTAL=>10000, :T_CLASS=>158280, :T_MODULE=>20672, :T_STRING=>527249 }
+ *
  *  This method is only expected to work on C Ruby.
  *
  */

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]