Skip to content

Commit b4b53d6

Browse files
committed
[DOC] Improve docs for ObjectSpace.count_objects_size
1 parent d5e2779 commit b4b53d6

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

ext/objspace/objspace.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,23 +221,26 @@ type2sym(enum ruby_value_type i)
221221

222222
/*
223223
* call-seq:
224-
* ObjectSpace.count_objects_size([result_hash]) -> hash
224+
* ObjectSpace.count_objects_size(result_hash = {}) -> result_hash
225225
*
226226
* Counts objects size (in bytes) for each type.
227227
*
228-
* Note that this information is incomplete. You need to deal with
229-
* this information as only a *HINT*. Especially, total size of
230-
* T_DATA may be wrong.
228+
* Note that the returned size may not be accurate, so it should only
229+
* be used as a hint. Specifically, the size for +T_DATA+ may be
230+
* inaccurate because these are custom objects defined in Ruby and
231+
* native extensions and so they may not accurately report their
232+
* memory size.
233+
*
234+
* It returns a hash that looks like:
231235
*
232-
* It returns a hash as:
233236
* {TOTAL: 1461154, T_CLASS: 158280, T_MODULE: 20672, T_STRING: 527249, ...}
234237
*
235-
* If the optional argument, result_hash, is given,
236-
* it is overwritten and returned.
237-
* This is intended to avoid probe effect.
238+
* The contents of the returned hash are implementation specific and
239+
* may be changed in future versions without notice.
238240
*
239-
* The contents of the returned hash is implementation defined.
240-
* It may be changed in future.
241+
* If the optional argument, +result_hash+, is given,
242+
* it is overwritten and returned.
243+
* This is intended to avoid the probe effect.
241244
*
242245
* This method is only expected to work with C Ruby.
243246
*/

0 commit comments

Comments
 (0)