I wrote a minimal memory allocator in C
Details
- External ID
- 46027962
- Source
- HN
- Company
- —
- Product
- I wrote a minimal memory allocator in C
- Website domain
- github.com
- Launched
- Nov. 23, 2025
- Cohort
- —
- Upvotes
- 137
- Upvotes percentile
- 0.9279475982532751
- Tags
- —
- Fetched at
- Sept. 7, 2026, 9:25 p.m.
- Updated at
- Sept. 7, 2026, 9:25 p.m.
Description
A fun toy memory allocator (not thread safe, that's a future TODO). I also wanted to explain how I approached it, so I also wrote a tutorial blog post (~20 minute read) covering the code which you can find the link to in the README.
Enrichment
- Theme
- systems tools and desktop utilities
- Vertical
- Horizontal
- Function
- Dev tools
- Audience
- Developer
- AI stance
- Not AI
- Project type
- Hobby / open-source project
- Normalized one-liner
- minimal c memory allocator
- Manually corrected
- False
Could you build this?
Yes A non-thread-safe toy memory allocator using basic `sbrk` or `mmap` syscalls in C is a standard computer science educational project that LLMs can generate and explain flawlessly.
Discussion
20 comments analyzed.
Competitors mentioned: C standard library malloc/free, jemalloc, tcmalloc, mimalloc
Concerns raised: Unspecified/non-portable behavior mixing brk()/sbrk() with other memory functions, realloc() has inconsistencies and corner cases with mmapped blocks, Missing overflow checks on size+META_SIZE in multiple spots, Not suitable for general-purpose library use due to application-specific assumptions, Single-threaded only, performance concerns with large fragmentation scenarios
Feature requests: Add static keyword to internal functions and constants for proper encapsulation, Add overflow checks for size+META_SIZE operations, Improve realloc() handling of mmapped blocks during shrinking, Only track freed nodes in free_list, not all nodes, Add more const qualifiers for clarity
Competitors
Other products that read as similar to this one — 135 launches clear the similarity bar, closest 8 shown.
Attention rank: #15 of 136 (itself plus its competitors, highest first — normalized so YC and Product Hunt are compared fairly).
Launched 23 days after the earliest competitor.
- Built a tiny interpreter from scratch in C to understand how they work · hn · 2025-11-12 · 5 upvotes · similarity 0.57
- Threadprocs · hn · 2026-03-23 · 64 upvotes · similarity 0.50
- CJIT, a single-binary C compiler that can self host · hn · 2026-04-13 · 7 upvotes · similarity 0.48
- genpark-buddy-memory-allocator-binary-tree-skill · github · 2026-09-28 · 7 upvotes · similarity 0.48
- C/C++ Cheatsheet · hn · 2026-01-23 · 10 upvotes · similarity 0.46
- Nibble · hn · 2026-05-14 · 102 upvotes · similarity 0.46
- helloworld-bruteforced · github · 2026-09-10 · 38 upvotes · similarity 0.46
- I built simple and efficient local memory system for Claude Code · hn · 2026-02-02 · 6 upvotes · similarity 0.46
Other launches for this product
- No other launches for this product.
Same idea, different domain
Nobody's really built a dev tools tool for Sales yet.