Guest User

Untitled

a guest
Feb 16th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. open Gc
  2.  
  3. let alloc n =
  4. let _ = String.make n '4' in
  5. ()
  6.  
  7. let process_stuff () = ()
  8.  
  9. let rec main n =
  10. print_endline (string_of_int n);
  11. alloc n;
  12. let sb = stat () in
  13. Printf.printf "Before: %d, %d\n" sb.heap_words sb.live_words;
  14. Gc.compact ();
  15. Gc.full_major ();
  16. let sa = stat () in
  17. Printf.printf " After: %d, %d\n" sa.heap_words sa.live_words;
  18. process_stuff ();
  19. let _ = read_line () in
  20. main (n * 2)
  21.  
  22. let _ = main (1 lsl 28)
Add Comment
Please, Sign In to add comment