$ poly -v
Poly/ML 5.9.2 Release RTS version: X86_64-5.9.2
$ cat code.sml
(* This allocates ~80MB of live data that cannot be GC'd *)
fun make_list 0 acc = acc
| make_list n acc = make_list (n-1) ((n, Array.array(10000, n)) :: acc)
val _ = print "Allocating 1000 arrays of 10000 ints each (~80MB)...\n"
val big = make_list 1000 [];
val _ = print ("Success: Created " ^ Int.toString (length big) ^ " arrays\n");
val _ = OS.Process.exit OS.Process.success;
$ poly <code.sml
Poly/ML 5.9.2 Release
Allocating 1000 arrays of 10000 ints each (~80MB)...
val big =
[(1, fromList[1, 1, 1, 1, 1, 1, 1, 1, 1, ...]),
(2, fromList[2, 2, 2, 2, 2, 2, 2, 2, ...]),
(3, fromList[3, 3, 3, 3, 3, 3, 3, ...]),
(4, fromList[4, 4, 4, 4, 4, 4, ...]), (5, fromList[5, 5, 5, 5, 5, ...]),
(6, fromList[6, 6, 6, 6, ...]), (7, fromList[7, 7, 7, ...]),
(8, fromList[8, 8, ...]), (9, fromList[9, ...]), (10, fromList[...]),
...]: (int * int array) list
val make_list = fn: int -> (int * int array) list -> (int * int array) list
Success: Created 1000 arrays
$ poly --maxheap=2 <code.sml
Poly/ML 5.9.2 Release
Run out of store - interrupting threads
Run out of store - interrupting threads
Run out of store - interrupting threads
Run out of store - interrupting threads
Run out of store - interrupting threads
[...truncated...]
$ poly --maxheap=1 <code.sml
Poly/ML 5.9.2 Release
Allocating 1000 arrays of 10000 ints each (~80MB)...
val big =
[(1, fromList[1, 1, 1, 1, 1, 1, 1, 1, 1, ...]),
(2, fromList[2, 2, 2, 2, 2, 2, 2, 2, ...]),
(3, fromList[3, 3, 3, 3, 3, 3, 3, ...]),
(4, fromList[4, 4, 4, 4, 4, 4, ...]), (5, fromList[5, 5, 5, 5, 5, ...]),
(6, fromList[6, 6, 6, 6, ...]), (7, fromList[7, 7, 7, ...]),
(8, fromList[8, 8, ...]), (9, fromList[9, ...]), (10, fromList[...]),
...]: (int * int array) list
val make_list = fn: int -> (int * int array) list -> (int * int array) list
Success: Created 1000 arrays
$ poly -v Poly/ML 5.9.2 Release RTS version: X86_64-5.9.2 $ cat code.sml (* This allocates ~80MB of live data that cannot be GC'd *) fun make_list 0 acc = acc | make_list n acc = make_list (n-1) ((n, Array.array(10000, n)) :: acc) val _ = print "Allocating 1000 arrays of 10000 ints each (~80MB)...\n" val big = make_list 1000 []; val _ = print ("Success: Created " ^ Int.toString (length big) ^ " arrays\n"); val _ = OS.Process.exit OS.Process.success; $ poly <code.sml Poly/ML 5.9.2 Release Allocating 1000 arrays of 10000 ints each (~80MB)... val big = [(1, fromList[1, 1, 1, 1, 1, 1, 1, 1, 1, ...]), (2, fromList[2, 2, 2, 2, 2, 2, 2, 2, ...]), (3, fromList[3, 3, 3, 3, 3, 3, 3, ...]), (4, fromList[4, 4, 4, 4, 4, 4, ...]), (5, fromList[5, 5, 5, 5, 5, ...]), (6, fromList[6, 6, 6, 6, ...]), (7, fromList[7, 7, 7, ...]), (8, fromList[8, 8, ...]), (9, fromList[9, ...]), (10, fromList[...]), ...]: (int * int array) list val make_list = fn: int -> (int * int array) list -> (int * int array) list Success: Created 1000 arrays $ poly --maxheap=2 <code.sml Poly/ML 5.9.2 Release Run out of store - interrupting threads Run out of store - interrupting threads Run out of store - interrupting threads Run out of store - interrupting threads Run out of store - interrupting threads [...truncated...] $ poly --maxheap=1 <code.sml Poly/ML 5.9.2 Release Allocating 1000 arrays of 10000 ints each (~80MB)... val big = [(1, fromList[1, 1, 1, 1, 1, 1, 1, 1, 1, ...]), (2, fromList[2, 2, 2, 2, 2, 2, 2, 2, ...]), (3, fromList[3, 3, 3, 3, 3, 3, 3, ...]), (4, fromList[4, 4, 4, 4, 4, 4, ...]), (5, fromList[5, 5, 5, 5, 5, ...]), (6, fromList[6, 6, 6, 6, ...]), (7, fromList[7, 7, 7, ...]), (8, fromList[8, 8, ...]), (9, fromList[9, ...]), (10, fromList[...]), ...]: (int * int array) list val make_list = fn: int -> (int * int array) list -> (int * int array) list Success: Created 1000 arrays