4 let leak1 = 1024 * 1024
8 let s = String.make
leak1 'c'
in
9 set_httppost
h [CURLFORM_CONTENT
("part", s, DEFAULT
)];
13 let path = Printf.sprintf
"/proc/%d/statm" (Unix.getpid
()) in
15 let ch = open_in
path in
16 let n = Scanf.fscanf
ch "%_d %d" (fun x
-> 4*1024*x
) in close_in_noerr
ch; n
17 with exn
-> Printf.eprintf
"Error opening %s (%s), ignoring\n%!" path (Printexc.to_string exn
); 0
21 for i
= 0 to count1 do
26 Printf.printf
"RSS %d -> %d %s\n%!" rss1 rss2 (if rss2 - rss1 < count1 * leak1 / 10 then "OK" else "LEAKING")