5 let s1 = String.make size 'd'
in
7 let s2 = String.make size 'c'
in
8 set_httppost
h [CURLFORM_CONTENT
("part", s2, DEFAULT
)];
9 assert (get_private
h = s1);
14 let s = String.make size 'a'
in
15 set_mimepost
h [{encoding
=CURLMIME_BINARY
;headers
=[];subparts
=[];data
=CURLMIME_DATA
s}];
16 let g = duphandle
h in
21 let path = Printf.sprintf
"/proc/%d/statm" (Unix.getpid
()) in
23 let ch = open_in
path in
24 let n = Scanf.fscanf
ch "%_d %d" (fun x
-> 4*1024*x
) in close_in_noerr
ch; n
25 with exn
-> Printf.eprintf
"Error opening %s (%s), ignoring\n%!" path (Printexc.to_string exn
); 0
27 let check test count leak_size
=
34 Printf.printf
"RSS %d -> %d %s\n%!" rss1 rss2 (if rss2 - rss1 < count
* leak_size
/ 10 then "OK" else "LEAKING")
37 let mb = 1024 * 1024 in