blob: 424aa16ab320b04067faf431ba1d0afc3de65139 (
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
|
(* TEST
native;
*)
type 'a typ = Int : int typ | Ptr : int list typ
let f (type a) (t : a typ) (p : int list) : a =
match t with
| Int -> 100
| Ptr -> p
let allocate_garbage () =
for i = 0 to 100 do
ignore (Array.make 200 0.0)
done
let g (t : int list typ) x =
Gc.minor ();
let x = f t ([x; x; x; x; x]) in
Gc.minor ();
allocate_garbage ();
ignore (String.length (String.concat " " (List.map Int.to_string x)))
let () = g Ptr 5
|