Skip to content

Commit d8b60ee

Browse files
committed
[DOC] Improve docs for ObjectSpace.count_objects
1 parent c9f5552 commit d8b60ee

1 file changed

Lines changed: 21 additions & 16 deletions

File tree

gc.c

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2699,29 +2699,34 @@ count_objects_i(VALUE obj, void *d)
26992699

27002700
/*
27012701
* call-seq:
2702-
* ObjectSpace.count_objects([result_hash]) -> hash
2702+
* ObjectSpace.count_objects(result_hash = {}) -> hash
27032703
*
2704-
* Counts all objects grouped by type.
2704+
* Counts the number of objects, grouped by type.
27052705
*
2706-
* It returns a hash, such as:
2707-
* {
2708-
* TOTAL: 10000,
2709-
* FREE: 3011,
2710-
* T_OBJECT: 6,
2711-
* T_CLASS: 404,
2712-
* # ...
2713-
* }
2706+
* It returns a hash that looks like:
27142707
*
2715-
* The contents of the returned hash are implementation specific.
2716-
* It may be changed in future.
2708+
* {
2709+
* TOTAL: 10000,
2710+
* FREE: 3011,
2711+
* T_OBJECT: 6,
2712+
* T_CLASS: 404,
2713+
* # ...
2714+
* }
27172715
*
2718-
* The keys starting with +:T_+ means live objects.
2716+
* The contents of the returned hash are implementation specific and
2717+
* may be changed in future versions without notice.
2718+
*
2719+
* The keys starting with +:T_+ are live objects of a particular type.
27192720
* For example, +:T_ARRAY+ is the number of arrays.
2720-
* +:FREE+ means object slots which is not used now.
2721-
* +:TOTAL+ means sum of above.
2721+
*
2722+
* The key +:FREE+ is the number of object slots which are empty.
2723+
*
2724+
* The key +:TOTAL+ is the total number of slots (which is the sum of
2725+
* all of the other values).
27222726
*
27232727
* If the optional argument +result_hash+ is given,
2724-
* it is overwritten and returned. This is intended to avoid probe effect.
2728+
* it is overwritten and returned.
2729+
* This is intended to avoid the probe effect.
27252730
*
27262731
* h = {}
27272732
* ObjectSpace.count_objects(h)

0 commit comments

Comments
 (0)