fix-ocaml-gc

Debug and fix OCaml garbage collector runtime bugs using GDB.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/Zurybr/lefarma-skills --skill fix-ocaml-gc-zurybr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fix-ocaml-gc
Source: https://github.com/Zurybr/lefarma-skills/tree/main/letta/benchmarks/trajectory-only/fix-ocaml-gc
Command: npx skills add https://github.com/Zurybr/lefarma-skills --skill fix-ocaml-gc-zurybr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a structured approach to diagnosing and resolving complex bugs within the OCaml garbage collector, particularly those affecting memory management and runtime stability.

Core Features & Use Cases

  • Systematic Debugging: Guides users through build system analysis, crash diagnostics, and code investigation for GC-related issues.
  • Root Cause Identification: Helps pinpoint memory corruption, pointer arithmetic errors, and issues in sweeping, marking, or pool management.
  • Use Case: When OCaml compilation crashes with segmentation faults during bootstrap, this Skill offers a step-by-step process to analyze the OCaml runtime's C code and identify the faulty GC logic.

Quick Start

Use the fix-ocaml-gc skill to debug a segmentation fault during OCaml bootstrap by analyzing the runtime/shared_heap.c file.

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 a segmentation fault during the OCaml bootstrap process?

To debug an OCaml bootstrap segmentation fault, analyze the runtime's C code using GDB to trace crashes in shared_heap.c. This systematic workflow helps identify faulty garbage collector logic, including memory corruption and pointer arithmetic errors in sweeping or pool management code.

What causes memory corruption in the OCaml garbage collector runtime?

Memory corruption in the OCaml garbage collector runtime typically stems from pointer arithmetic errors and issues in sweeping, marking, or pool management. Identifying these root causes requires investigating the C-level runtime structures and analyzing how memory pools are managed and traversed.

Do I need to understand C and GDB to fix OCaml garbage collector bugs?

Yes, fixing OCaml garbage collector bugs requires understanding C-level debugging with GDB and OCaml's internal memory structures. You must navigate the OCaml build process and investigate the runtime's C code to pinpoint memory management issues like segfaults.

What is the best way to investigate crashes in OCaml's shared_heap.c file?

The best way to investigate crashes in OCaml's shared_heap.c is to follow a structured debugging workflow that combines build system analysis with crash diagnostics. This process involves using GDB to examine the C code and identify faulty garbage collection logic.

Why does OCaml compilation crash with segmentation faults during garbage collection sweeping?

OCaml compilation crashes with segfaults during garbage collection sweeping due to faulty logic in the runtime's memory management code. A systematic debugging approach can trace these crashes to pointer arithmetic errors or pool management issues within the C-level GC implementation.