memory-allocator
Skill17 starsChanged 9 months agoApache-2.0View on GitHub
Implement memory allocators for efficient dynamic memory management in language runtimes.
In this repository98 other files it gives its agents.
- abstract-interpretation-engineSkill
- abstract-machineSkill
- acsl-annotation-assistantSkill
- actor-model-implementerSkill
- algebraic-effectsSkill
- alias-and-points-to-analysisSkill
- axiomatic-semanticsSkill
- bidirectional-type-checkingSkill
- bisimulation-checkerSkill
- capability-systemSkill
- closure-converterSkill
- common-subexpression-eliminatorSkill
- concurrency-verifierSkill
- constant-propagation-passSkill
- contextual-equivalenceSkill
- control-flow-analysisSkill
- coq-proof-assistantSkill
- cps-transformerSkill
- dafny-verifierSkill
- dataflow-analysis-frameworkSkill
- dead-code-eliminatorSkill
- defunctionalizationSkill
- denotational-semantics-builderSkill
- dependent-type-implementerSkill
- dsl-embeddingSkill
- effect-handlers-implementerSkill
- effect-systemSkill
- effect-type-systemSkill
- escape-analysisSkill
- existential-typesSkill
- ffi-designerSkill
- fuzzer-generatorSkill
- gadt-implementerSkill
- garbage-collector-implementerSkill
- graalvm-truffle-implementerSkill
- gradual-typing-implementerSkill
- higher-order-abstract-syntaxSkill
- hoare-logic-verifierSkill
- incremental-computationSkill
- information-flow-analyzerSkill
- inline-expanderSkill
- interprocedural-analysisSkill
- invariant-generatorSkill
- jit-compiler-builderSkill
- lambda-calculus-interpreterSkill
- language-server-protocolSkill
- lean-proverSkill
- lexer-generatorSkill
- linear-type-implementerSkill
- liveness-analysisSkill
- llvm-backend-generatorSkill
- lock-free-data-structureSkill
- loop-optimizerSkill
- loop-termination-proverSkill
- macro-expanderSkill
- message-passing-systemSkill
- mlir-dialect-designerSkill
- model-checkerSkill
- module-systemSkill
- monad-transformerSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 43
Use slab allocators for fixed-size objects
- Distinctive: line 44
Use arena allocators for temporary allocations
- Distinctive: line 47
Use generation counters for safe references
- Distinctive: line 83
When OS allocator suffices
- Distinctive: line 85
When memory is not a concern
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Memory Allocator
Memory allocators manage dynamic memory allocation and deallocation, a critical component of language runtimes. Different allocation strategies optimize for different workloads.
When to Use This Skill
- Implementing language runtimes
- Building custom allocators
- Optimizing memory performance
- Embedded systems development
- Understanding memory management
What This Skill Does
- Block Allocation: Allocate fixed-size blocks efficiently
- Heap Management: Organize free memory
- Allocation Strategies: First-fit, best-fit, segregated fit
- Fragmentation Control: Minimize internal/external fragmentation
- Deallocation: Free memory and coalesce blocks
Key Concepts
| Concept | Description |
| Block | Contiguous memory region |
| Fragmentation | Wasted space (internal or external) |
| Free List | Linked list of free blocks |
| Coalescing | Merge adjacent free blocks |
| Slab | Pre-allocated block for fixed-size objects |
Tips
- Use slab allocators for fixed-size objects
- Use arena allocators for temporary allocations
- Consider alignment requirements
- Profile before optimizing allocation
- Use generation counters for safe references
Common Use Cases
- Language runtime allocators
- Game engines (arena allocators)
- Database buffer pools
- Embedded systems
- High-performance systems
Related Skills
garbage-collector-implementer- Automatic memory managementescape-analysis- Optimize allocationjit-compiler-builder- JIT allocation
Canonical References
| Reference | Why It Matters |
| Wilson et al., "Dynamic Storage Allocation" (1994) | Survey of algorithms |
| Bonwick, "The Linux Slab Allocator" (USENIX 1994) | Linux slab allocator |
| Berger, McKinley, Blumofe & Wilson, "Hoard: A Scalable Memory Allocator for Multithreaded Applications" (ASPLOS 2000) | Scalable multicore allocator |
Tradeoffs and Limitations
Approach Tradeoffs
| Approach | Pros | Cons |
| Bump pointer | Very fast | Cannot free individually |
| Free list | Can free | Fragmentation |
| Slab | No fragmentation | Fixed size only |
When NOT to Use This Skill
- When OS allocator suffices
- For small programs
- When memory is not a concern
Limitations
- Thread safety requires synchronization
- Fragmentation is hard to eliminate
- Cannot allocate more than capacity
Assessment Criteria
A high-quality implementation should have:
| Criterion | What to Look For |
| Correctness | No corruption, double-free safe |
| Efficiency | Low allocation overhead |
| Fragmentation | Reasonable memory usage |
| Safety | Bounds checking |
Quality Indicators
✅ Good: Correct, efficient, handles edge cases ⚠️ Warning: Fragmentation issues ❌ Bad: Memory corruption, crashes
Research Tools & Artifacts
Real-world memory allocators:
| Tool | Why It Matters |
| jemalloc | Facebook allocator |
| tcmalloc | Google allocator |
| Hoard | Scalable allocator |
| snmalloc | Microsoft's allocator |
| RPMalloc | Fast allocator |
Key Systems
- jemalloc: Production allocator
- tcmalloc: glibc allocator
Research Frontiers
Current allocator research:
| Direction | Key Papers | Challenge |
| Scalable | "Scalable Allocators" | Multi-core |
| NUMA | "NUMA-aware" | Memory hierarchy |
| Large | "Large allocators" | Big data |
Hot Topics
- Allocator for Wasm: WebAssembly allocation
- Allocator for Rust: Custom allocators
Implementation Pitfalls
Common allocator bugs:
| Pitfall | Real Example | Prevention |
| Fragmentation | Memory fragmentation | Slab alloc |
| Thread contention | Lock contention | Per-thread pools |
| Memory | Memory corruption | Bounds checking |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

