Skip to content

Commit b516815

Browse files
authored
Merge pull request ocaml#13440 from jmid/gc-control-docs
Update Gc.control documentation to OCaml 5
2 parents 81003f2 + 28aefb4 commit b516815

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

Changes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,10 @@ ___________
380380
`live_words`, `live_blocks`, `free_words`, and `fragments` are not zero.
381381
(Jan Midtgaard, review by Damien Doligez and KC Sivaramakrishnan)
382382

383+
- #13440: Update documentation of `Gc.{control,get,set}` to reflect fields
384+
not currently supported on OCaml 5.
385+
(Jan Midtgaard, review by Gabriel Scherer)
386+
383387
### Compiler user-interface and warnings:
384388

385389
* #12084: Check link order when creating archive and when using ocamlopt

stdlib/gc.mli

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ type control =
122122
number is less than or equal to 1000, it is a percentage of
123123
the current heap size (i.e. setting it to 100 will double the heap
124124
size at each increase). If it is more than 1000, it is a fixed
125-
number of words that will be added to the heap. Default: 15. *)
125+
number of words that will be added to the heap.
126+
127+
This field is currently not available in OCaml 5: the field value is
128+
always [0]. *)
126129

127130
space_overhead : int;
128131
(** The major GC speed is computed from this parameter.
@@ -157,16 +160,19 @@ type control =
157160
compaction is triggered at the end of each major GC cycle
158161
(this setting is intended for testing purposes only).
159162
If [max_overhead >= 1000000], compaction is never triggered.
160-
Default: 500. *)
163+
164+
This field is currently not available in OCaml 5: the field value is
165+
always [0]. *)
161166

162167
stack_limit : int;
163168
(** The maximum size of the fiber stacks (in words).
164-
Default: 1024k. *)
169+
Default: 128M. *)
165170

166171
allocation_policy : int;
167172
(** The policy used for allocating in the major heap.
168173
169-
This option is ignored in OCaml 5.x.
174+
This field is currently not available in OCaml 5: the field value is
175+
always [0].
170176
171177
Prior to OCaml 5.0, possible values were 0, 1 and 2.
172178
@@ -182,8 +188,10 @@ type control =
182188
(** The size of the window used by the major GC for smoothing
183189
out variations in its workload. This is an integer between
184190
1 and 50.
185-
Default: 1.
186-
@since 4.03 *)
191+
@since 4.03
192+
193+
This field is currently not available in OCaml 5: the field value is
194+
always [0]. *)
187195

188196
custom_major_ratio : int;
189197
(** Target ratio of floating garbage to major heap size for
@@ -257,14 +265,22 @@ external get : unit -> control = "caml_gc_get"
257265
[@@alert unsynchronized_access
258266
"GC parameters are a mutable global state."
259267
]
260-
(** Return the current values of the GC parameters in a [control] record. *)
268+
(** Return the current values of the GC parameters in a [control] record.
269+
270+
The [major_heap_increment], [max_overhead], [allocation_policy], and
271+
[window_size] fields are currently not available in OCaml 5: their returned
272+
field values are therefore [0]. *)
261273

262274
external set : control -> unit = "caml_gc_set"
263275
[@@alert unsynchronized_access
264276
"GC parameters are a mutable global state."
265277
]
266-
(** [set r] changes the GC parameters according to the [control] record [r].
267-
The normal usage is: [Gc.set { (Gc.get()) with Gc.verbose = 0x00d }] *)
278+
(** [set r] changes the GC parameters according to the [control] record [r].
279+
The normal usage is: [Gc.set { (Gc.get()) with Gc.verbose = 0x00d }]
280+
281+
The [major_heap_increment], [max_overhead], [allocation_policy], and
282+
[window_size] fields are currently not available in OCaml 5: setting them
283+
therefore has no effect. *)
268284

269285
external minor : unit -> unit = "caml_gc_minor"
270286
(** Trigger a minor collection. *)

0 commit comments

Comments
 (0)