Skip to content

Instantly share code, notes, and snippets.

/memtest.ml Secret

Created September 27, 2012 12:27
Show Gist options
  • Save anonymous/3a98ab6c8792bc84be20 to your computer and use it in GitHub Desktop.
Save anonymous/3a98ab6c8792bc84be20 to your computer and use it in GitHub Desktop.
let number = 1024;;
let heavy_memory_object = Array.make_matrix 10 1000000 0;;
let rec odd n =
if (n mod 100) = 0 then Gc.print_stat stdout;
if n = 0 then true
else if n = 1 then false else even (n - 1)
and even n =
if n = 0 then false
else if n = 1 then true else odd (n - 1);;
try
let x = Gc.stat() in
x.Gc.minor_words;
if odd (number) then
print_endline ("Odd")
else
print_endline ("Even")
with
| _ -> failwith "SHIT WENT WRUNG"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment