Skip to content

Instantly share code, notes, and snippets.

Trace for /home/stephen/jswork/memtrace/_build/default/trace_ocamlopt/main.exe [17157]:
84485 samples of 0.6 GB allocations
98.7 MB (15.3%) at Stdlib__set.Make.bal (set.ml:125:12-62)
including:
92.8 MB via Optcompile.clambda.(fun) (27% of this)
92.7 MB via Asmgen.compile_unit.(fun) (28% of this)
92.0 MB via Asmgen.(++) (34% of this)
78.7 MB via Stdlib__set.Make.add (65% of this)
76.8 MB via Asmgen.regalloc (52% of this)
module String_ = struct
let split_gen str on =
let is_delim =
match on with
| true -> fun _ -> true
| false -> fun _ -> false
in
let rec loop acc = if is_delim str then acc else loop acc in
loop []
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stddef.h>
typedef void* (*memcpy_fn)(void*,const void*,size_t);
static __attribute__((noinline))
void test_overlapped_memcpy(memcpy_fn cpy, const char* fnname, int len, int off) {
int i;
(* TEST
* hassysthreads
include systhreads
** bytecode
** native
*)
let (rd, wr) = Unix.pipe ()
# Module New_frametable New_debuginfo Trunk_frametable Trunk_debuginfo
Afl_instrument 1592 896 1360 560
Alias_analysis 872 296 856 328
Allocated_const 344 152 360 232
Arch 1520 392 1592 528
Arg_helper 1144 520 1096 536
Asmgen 2728 1320 2784 1864
Asmlibrarian 728 352 696 432
Asmlink 5320 2192 5608 2888
Asmpackager 3232 1240 3304 1608
let samples = ref 0 and deallocs = ref 0 and promote = ref 0 and deallocs_maj = ref 0
let rec recur n f = match n with 0 -> f () | n -> recur (n-1) f + 1
let () =
let r = Array.make 65536 [| |] in
Gc.Memprof.start
~callstack_size:10
~minor_alloc_callback:(fun _ -> incr samples; Some ())
~major_alloc_callback:(fun _ -> assert false)
let f n =
((n lsl 1) + 1) / 2
let r = ref max_int
let () =
Printf.printf "%d\n" (f !r)
#include <spawn.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>
extern char** environ;
int main(int argc, char* argv[]) {
pid_t pid;
int err, status, i;
external hit_assert : unit -> unit = "hit_assert"
let () = hit_assert (); Gc.print_stat stdout
open Crowbar
open Parmatch
open Typedtree
let top_pretty = Printpat.top_pretty
let ident = choose [const (Ident.create "a"); const (Ident.create "b"); const (Ident.create "c")]
let label = choose [const "A"; const "B"]
let concat gens = map [list1 (choose gens)] List.concat