
from ocaml-claude-marketplace24
Instrument OCaml programs with memtrace to find allocation hotspots and recommend concrete optimizations to reduce boxing and allocations.
OCaml Memtrace Profiling guides an agent through instrumenting executables or tests with memtrace, running targeted benchmarks, and analysing trace output to identify allocation hotspots. It emphasises gating tracing behind an environment variable, focusing on targeted tests/benchmarks, and producing actionable fixes (e.g., avoid boxing, reduce closures, use unsafe array access where safe). The skill includes patterns for instrumentation, running memtrace, analysing traces with memtrace-viewer or CLI tools, and a workflow for baseline -> identify -> fix -> validate.
Use this skill when you need to investigate allocation-heavy code paths in OCaml: diagnosing unexpected allocations, finding boxing sources (int32/int64), or validating the effect of optimisations with before/after memtrace runs. Avoid for precise timing or leak hunting — it's sampling-focused for allocation hotspots.
Best suited for code-aware agents and environments with OCaml toolchains available (dune, opam). Works with agents able to run shell commands and inspect repository test/benchmark targets.
This skill has not been reviewed by our automated audit pipeline yet.