Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问clear审计通过

fix-ocaml-gc修复 ocaml GC

Agent Skill

fix-ocaml-gc 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

832

周安装

34

GitHub Stars

93

下载量

269
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:fix-ocaml-gc(修复 ocaml GC)
来源仓库:https://github.com/letta-ai/skills
仓库路径:skills/fix-ocaml-gc
安装命令:
npx skills add https://github.com/letta-ai/skills --skill fix-ocaml-gc
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/letta-ai/skills --skill fix-ocaml-gc

简介

fix-ocaml-gc 用于查找、检索和筛选相关信息。

  • 适合在 OCaml 垃圾回收优化或内存管理相关任务中。
  • 通过 npx skills add 命令从 letta-ai/skills 仓库安装。
  • 需确认是否操作底层运行时或影响性能。
  • 建议在测试环境中验证其稳定性。fix-ocaml-gc 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Fixing OCaml Garbage Collector Bugs

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

When to Use This Skill

  • Debugging segfaults or memory corruption in OCaml's C runtime
  • Fixing bugs in the GC's sweeping or allocation logic
  • Working with size-classed memory pools and free block management
  • Investigating pointer arithmetic issues in memory managers
  • Analyzing run-length encoded free lists

Environment Setup

Establish Context First

Before making any changes:

  1. Check repository type: Verify if the project is a git repository before running git commands
  2. Understand the build system: Read build documentation (e.g., HACKING.adoc, INSTALL, Makefile) to understand compilation steps
  3. Verify file paths: Always use absolute paths when reading files to avoid path resolution errors
  4. Identify OCaml version: Different OCaml versions have different GC implementations (especially OCaml 5.x with multicore support)

Build Configuration

When building the OCaml compiler:

  1. Use appropriate timeouts: OCaml bootstrap compilation is lengthy; use timeouts of 10+ minutes for full builds
  2. Consider background builds: For long compilations, run in background and monitor progress
  3. Incremental builds: After initial bootstrap, use make without world target for faster iteration
# Initial configuration
./configure

# Full build (may take 10+ minutes)
make world

# Incremental rebuild after changes
make

Debugging Approach

Locating GC Code

Key files in OCaml's runtime for GC-related issues:

  • runtime/shared_heap.c - Shared heap management (OCaml 5.x)
  • runtime/major_gc.c - Major GC implementation
  • runtime/minor_gc.c - Minor GC implementation
  • runtime/memory.c - Memory allocation primitives
  • runtime/gc_ctrl.c - GC control and statistics

Understanding Memory Layout

When analyzing GC bugs, understand these concepts:

  1. Block headers: OCaml blocks have headers containing size (wosize) and tag information
  2. Size classes: Memory pools organize blocks by size class for efficient allocation
  3. Free lists: Free blocks may be linked or use run-length encoding
  4. Header repurposing: Free block headers may repurpose fields (e.g., wosize for run-length counts)

Common Bug Patterns

Pointer Arithmetic Mismatches

A frequent bug pattern occurs when code uses header-derived sizes inappropriately:

// INCORRECT: Using header size for pool blocks
p += Whsize_hd(hd);  // May read repurposed field

// CORRECT: Using known block size for size-classed pools
p += wh;  // Use the fixed size class width

Root cause: In size-classed pools, all blocks have a fixed size wh determined by the size class. However, free block headers may repurpose the wosize field for other purposes (e.g., run-length encoding of contiguous free blocks). Using Whsize_hd(hd) reads this repurposed value instead of the actual block size.

Symptoms of Pointer Arithmetic Bugs

  • Segfaults during sweeping or compaction
  • Memory corruption that appears intermittent
  • Crashes only occurring with certain heap sizes or allocation patterns

Systematic Code Analysis

When investigating a bug:

  1. Trace the iteration: Follow pointer advancement through loops
  2. Identify size sources: Determine where block sizes come from (header vs. pool metadata)
  3. Check free block handling: Special attention to how free blocks differ from allocated blocks
  4. Verify invariants: Ensure pointer stays within valid memory regions

Verification Strategies

Testing the Fix

  1. Compilation test: Ensure the runtime compiles without errors
  2. Basic testsuite: Run the basic test suite to catch regressions
# Run basic tests (use quotes for DIR variable)
make -C testsuite DIR='tests/basic' all
  1. Full testsuite: For comprehensive verification, run the complete test suite

Shell Command Pitfalls

When running tests via Makefiles:

  • Quote variable assignments: Use DIR='tests/basic' instead of DIR=tests/basic to avoid shell interpretation issues
  • Watch for escaping: Makefile variables may need different quoting than direct shell commands

Search for Similar Bugs

After fixing a bug, search for similar patterns:

# Search for similar pointer arithmetic patterns
grep -n "Whsize_hd" runtime/*.c
grep -n "+= wh" runtime/*.c

Common Pitfalls

  1. Timeout too short: OCaml compilation needs extended timeouts (10+ minutes for full build)
  2. Relative paths: Always use absolute paths when reading files
  3. Git assumptions: Check if directory is a git repository before using git commands
  4. Incomplete verification: After fixing one instance, search for similar patterns elsewhere
  5. Shell quoting: Makefile variable assignments require careful quoting
  6. Header semantics: Remember that header fields may have different meanings for free vs. allocated blocks

Minimal Fix Principle

When fixing GC bugs:

  1. Understand the root cause: Ensure full understanding before changing code
  2. Make minimal changes: Change only what's necessary to fix the bug
  3. Preserve existing behavior: Avoid refactoring or "improving" surrounding code
  4. Document the fix: Ensure the change is self-explanatory or add a comment if needed

Verification Checklist

Before considering a fix complete:

  • Code compiles without errors or warnings
  • Basic testsuite passes
  • Searched for similar patterns in the codebase
  • Verified the fix addresses the root cause, not just symptoms
  • Considered edge cases (empty pools, boundary conditions, different size classes)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

32.72%
按下载量换算88

Antigravity

21.03%
按下载量换算57

windsurf

16.89%
按下载量换算45

Codex

12.99%
按下载量换算35

OpenCode

8.27%
按下载量换算22

Gemini CLI

3.55%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/letta-ai/skills --skill fix-ocaml-gc;npx skills add letta-ai/skills --skill "fix-ocaml-gc" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills