fix-ocaml-gc

Diagnose and fix OCaml garbage collector bugs in the C runtime.

134|21|Updated Nov 12, 2025
One-click install
npx skills add https://github.com/letta-ai/skills --skill fix-ocaml-gc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fix-ocaml-gc
Source: https://github.com/letta-ai/skills/tree/main/ai/benchmarks/letta/terminal-bench-2/trajectory-feedback/fix-ocaml-gc
Command: npx skills add https://github.com/letta-ai/skills --skill fix-ocaml-gc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides guidance for debugging and fixing memory-management bugs in the OCaml garbage collector runtime, with emphasis on memory handling in sweeping, allocation, and free-list management.

Core Features & Use Cases

  • GC memory debugging: Diagnose issues in OCaml's C runtime related to sweeping, allocation, and free-list handling.
  • Pointer arithmetic patterns: Identify common pitfalls when using size-classed pools and run-length encoding in GC code.
  • Structured debugging workflow: Follow a methodical approach to reproduce, isolate, and fix GC-related bugs with verification steps.

Quick Start

Example: Use this Skill when you encounter segfaults in OCaml GC, then follow its steps to locate root causes, apply fixes in the runtime, and run the runtime tests to verify correctness.

Frequently Asked Questions about fix-ocaml-gc

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug OCaml garbage collector segfaults?

OCaml GC segfaults typically stem from bugs in sweeping, allocation, or free-list management in the C runtime. Diagnose by reproducing the crash, examining runtime/major_gc.c and runtime/minor_gc.c for pointer arithmetic errors in size-classed pools, then verify fixes with full builds and runtime tests.

What causes memory corruption in OCaml's runtime garbage collector?

Memory corruption in OCaml's GC occurs when pointer arithmetic mistakes or faulty free-list logic corrupt heap state. Examine runtime/shared_heap.c, runtime/memory.c, and runtime/gc_ctrl.c for allocation and sweeping defects, isolate the root cause systematically, then apply minimal patches that preserve existing semantics.

How do I fix OCaml runtime memory management bugs?

Fix OCaml runtime memory bugs by following a structured debugging workflow: reproduce the issue, trace through GC code modules, identify logic flaws in sweeping or allocation, apply targeted patches, then run the full runtime test suite to verify correctness and ensure no semantic changes.

What are common pointer arithmetic pitfalls in OCaml GC code?

Common pitfalls in OCaml GC pointer arithmetic include incorrect calculations in size-classed pools and run-length encoding within free-list management. These errors corrupt heap metadata and trigger segfaults; systematic code review and verification testing catch and fix these issues reliably.

Can I debug OCaml garbage collector issues without modifying runtime source?

No. Fixing OCaml GC bugs requires modifying runtime source files like runtime/major_gc.c, runtime/minor_gc.c, and runtime/memory.c. Diagnose root causes through structured debugging, then apply minimal, well-documented patches and verify via full builds and runtime tests.