@@ -295,6 +295,8 @@ external bytes_create :
295
295
int -> local_ bytes = " caml_create_local_bytes"
296
296
external bytes_set :
297
297
local_ bytes -> int -> char -> unit = " %bytes_unsafe_set"
298
+ external bytes_get :
299
+ local_ bytes -> int -> char = " %bytes_unsafe_get"
298
300
external bytes_fill :
299
301
local_ bytes -> int -> int -> char -> unit = " caml_fill_bytes"
300
302
external bytes_blit_string :
@@ -419,6 +421,14 @@ let[@inline never] optionaleta () =
419
421
use_clos (Sys. opaque_identity optarg);
420
422
()
421
423
424
+ (* Test big local stack. The following will allocate 5G bytes on the local stack
425
+ , which is higher than the original 4G limit. *)
426
+ let [@ inline never] huge () =
427
+ let b = bytes_create (Int. shift_left 5 30 ) in
428
+ let pos = Int. shift_left 4 30 in
429
+ bytes_set b pos 'h' ;
430
+ assert (bytes_get b pos = 'h' )
431
+
422
432
let run name f x =
423
433
let prebefore = Gc. allocated_bytes () in
424
434
let before = Gc. allocated_bytes () in
@@ -473,6 +483,10 @@ let () =
473
483
run " optionalarg" optionalarg (fun_with_optional_arg, 10 );
474
484
run " optionaleta" optionaleta ()
475
485
486
+ (* The following test commented out as it require more memory than the CI has
487
+ *)
488
+ (* run "huge" huge () *)
489
+
476
490
(* In debug mode, Gc.minor () checks for minor heap->local pointers (and
477
491
backwards local pointers, which can't occur here) *)
478
492
let () = Gc. minor ()
0 commit comments