blob: 73960c4bcc19417a315a514c4ec7f022eff2e39f (
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
|
(* TEST
* native
*)
type 'a typ = Int : int typ | Ptr : int list typ | Int2 : int typ
let f (type a) (t : a typ) (p : int list) : a =
match t with
| Int -> 100
| Ptr -> p
| Int2 -> 200
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
|