Fix Gc.quick_stat documentation#13424
Conversation
|
@jmid: do you want to add an entry to the |
|
Thanks! I've added a Changes entry, thinking that users of these may potentially like to know. |
|
Indeed, documentation fixes should be cherry-picked to 5.3 (at least until the first rc). |
cddcd01 to
90761dc
Compare
| This function is much faster than [stat] because it does not need to | ||
| (** Returns a record with the current values of the memory management counters | ||
| like [stat]. Due to per-domain buffers it may only represent the state of | ||
| the program's total memory usage since the last minor collection or major |
There was a problem hiding this comment.
Are we sure this should be “since”? It does not read right to me. The number of minor GCs since the last minor GC will be 0, but what quick_stat returns is different. How about:
(** Returns a record with the current values of the memory management
counters like [stat]. Unlike [stat], [quick_stat] does not perform a full major
collection, and hence, is much faster. However, [quick_stat] reports the
counters sampled at the last minor collection or at the end of the last major
collection cycle (whichever is the latest). Hence, the memory stats returned
by [quick_stat] are not instantaneously accurate. *)
There was a problem hiding this comment.
Also, in the original comment, I am not sure which field the program's total memory usage is supposed to represent (if at all). The documentation attached to stats refers to the program's total memory stats, while being vague, is a bit more accurate. I did wonder whether usage was supposed to be stats.
There was a problem hiding this comment.
Sounds good to me!
The reordering of sentences also improve readability IMO, mentioning the central difference first and only secondly going into more detail.
|
@jmid Would you be able to squash the commits into a single commit? |
0cd8e38 to
c1f8f29
Compare
|
Sure, squashed and force pushed 👍 |
|
Thanks |
Gentle reminder to cherry-pick this documentation fix to 5.3 |
FYI @Octachron. Is there a label that we use to indicate that certain PRs are marked for cherry-picking to the release branch? |
|
Please feel free to cherry-pick yourself after merging, there is documentation on the specific git incantation recommended at https://github.com/ocaml/ocaml/blob/trunk/HACKING.adoc#keep-merge-commits-when-merging-and-cherry-picking-github-prs |
|
A label could be helpful when checking that no bug fixes was forgotten. Maybe a whole set |
Alternatively, adding this to the 5.3 milestone may be better to avoid polluting the labels namespace with many different labels per release? I've done so now. |
|
The milestone has the downside of marking things as 'Closed' once a PR is merged, thus risking to forget to cherry-pick 🤷 |
Fix Gc.quick_stat documentation (cherry picked from commit 00d89ea)
While torturing the poor
Gcmodule, a test spotted that theGc.quick_statdocumentation was a bit off.live_words,live_blocks,free_words, andfragmentsfields are not zerolargest_freeandstack_sizefields returned byGc.statare also 0 (along withheap_chunksandfree_blocks- as documented in thestatrecord type at the top) and hence better be documented in thestatfunctionI can see #12850 included in 5.2.0 made adjustments to the
Gc.quick_statfunctionality and documentation, but OCaml5 has returned non-zero fields for these entries since 5.0.0 AFAICS.A top-level example to illustrate: