blob: 395070a2c8d2550a4b636660d3d2470ccd236720 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
(* TEST
modules = "minor_no_postpone_stub.c";
reason = "port stat-mem-prof : https://github.com/ocaml/ocaml/pull/8634";
skip;
*)
open Gc.Memprof
let notify_minor ref_ok ref_done =
{ null_tracker with
alloc_minor = (fun _ ->
assert !ref_ok;
ref_done := true;
None);
}
let () =
let callback_ok = ref true in
let callback_done = ref false in
start ~callstack_size:0 ~sampling_rate:1.
(notify_minor callback_ok callback_done);
ignore (Sys.opaque_identity (ref 0));
assert(!callback_done);
callback_ok := false;
stop ()
external alloc_stub : unit -> unit ref = "alloc_stub"
let () =
let callback_ok = ref false in
let callback_done = ref false in
start ~callstack_size:0 ~sampling_rate:1.
(notify_minor callback_ok callback_done);
ignore (Sys.opaque_identity (alloc_stub ()));
assert(not !callback_done);
callback_ok := true;
ignore (Sys.opaque_identity (ref ()));
assert(!callback_done);
stop ()
|