frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Show HN: I wrote a minimal memory allocator in C

https://github.com/t9nzin/memory
82•t9nzin•9h ago•19 comments

Show HN: Syd – An offline-first, AI-augmented workstation for blue teams

https://www.sydsec.co.uk
2•paul2495•39m ago•0 comments

Show HN: Simulating the vacuum as a superfluid to derive Alpha = 1/137

https://github.com/moseszhu999/geometric-vacuum-sim
3•moseszhu•54m ago•1 comments

Show HN: Gitlogue – A terminal tool that replays your Git commits with animation

https://github.com/unhappychoice/gitlogue
127•unhappychoice•5d ago•15 comments

Show HN: WeatherOrNot a maximal weather app in the terminal

https://james-see.github.io/weatherornot/
4•jamescampbell•1h ago•0 comments

Show HN: I built a free kids coloring site with AI

https://happykidscoloring.com/en
3•daimajia•2h ago•1 comments

Show HN: SitStand – Control your standing desk from the command line

https://gregraiz.com/blog/sitstand-bluetooth-desk-controller/
6•graiz•3h ago•0 comments

Show HN: Build the habit of writing meaningful commit messages

https://github.com/arpxspace/smartcommit
104•Aplikethewatch•1d ago•122 comments

Show HN: 3M km interferometer concept using Saturn moons

https://zenodo.org/records/17665935
2•kurtswendson•5h ago•0 comments

Show HN: Forty.News – Daily news, but on a 40-year delay

https://forty.news
419•foxbarrington•1d ago•167 comments

Show HN: Wealthfolio 2.0- Open source investment tracker. Now Mobile and Docker

https://wealthfolio.app/?v=2.0
663•a-fadil•2d ago•211 comments

Show HN: Revisit – Session recording analysis that "watches" the video

https://revisit.pro/
2•egykettoharo•8h ago•0 comments

Show HN: Built a tool solve the nightmare of chunking tables in PDF vs. Markdown

https://github.com/2dogsandanerd/smart-ingest-kit
3•2dogsanerd•13h ago•0 comments

Show HN: I built a wizard to turn ideas into AI coding agent-ready specs

https://vibescaffold.dev/
64•straydusk•1d ago•36 comments

Show HN: Real-time freelancer marketplace with per-second billing

https://gigs.quest/
4•ufvy•11h ago•5 comments

Show HN: I just fixed .env once and for all – better-env

https://better-env.dev
7•harish3304•12h ago•2 comments

Show HN: OhNiceRepo – Easily discover trending GitHub gems and repos

https://ohnicerepo.pages.dev
2•behnamazimi•13h ago•0 comments

Show HN: Genesis DB now provides a full gRPC API alongside HTTP

https://www.genesisdb.io/blog/posts/2025-11-23/grpc-endpoint
4•patriceckhart•13h ago•0 comments

Show HN: Search tool for "Ask HN: What Are You Working On?"

https://nthesis.ai/public/hn-working-on
6•osigurdson•14h ago•0 comments

Show HN: PolyGPT – ChatGPT, Claude, Gemini, Perplexity responses side-by-side

https://polygpt.app
23•ncvgl•1d ago•14 comments

Show HN: Dank-AI – Ship production AI agents 10x faster

https://www.dank-ai.xyz/
6•deltadarkly•1d ago•5 comments

Show HN: Makefiles, Metalanguages, Matrioshka Automata

https://robot-wranglers.github.io/compose.mk/
2•robot-wrangler•15h ago•0 comments

Show HN: Search London StreetView panoramas by text

https://london.publicinsights.uk
25•dfworks•3d ago•11 comments

Show HN: An OKLCH-based perceptually uniform color system/theme builder

https://colorphreak.com
5•kurainox•16h ago•1 comments

Show HN: I made a down detector for down detector

https://downdetectorsdowndetector.com
587•gusowen•5d ago•169 comments

Show HN: Vibe Prolog

https://github.com/nlothian/Vibe-Prolog
44•nl•4d ago•10 comments

Show HN: Zig's defer/errdefer for c99 and gnu11 C via macros

https://github.com/Trainraider/defer_h
2•Major_Baby_425•17h ago•0 comments

Show HN: F32 – An Extremely Small ESP32 Board

https://github.com/PegorK/f32
300•pegor•4d ago•51 comments

Show HN: RowboatX – open-source Claude Code for everyday automations

https://github.com/rowboatlabs/rowboat
130•segmenta•5d ago•41 comments

Show HN: Awesome J2ME

https://github.com/hstsethi/awesome-j2me
79•catstor•3d ago•54 comments
Open in hackernews

Show HN: I wrote a minimal memory allocator in C

https://github.com/t9nzin/memory
82•t9nzin•9h ago
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.

Comments

quibono•7h ago
I hate that very often my first reaction to Show HN posts like this is to cynically look for signs of blatant AI code use.

I don't think that's the case here though.

achierius•7h ago
Looks nice! Though I have to say, you should probably avoid sbreak even for small allocations -- obviously it's slow, but even beyond that you have to deal with the fact that it's essentially a global singleton and introduces a lot of subtle failure cases you might not think of + which you can't really solve anyways. It's better to mmap out some chunk of memory and sub-allocate it out yourself.
macintux•6h ago
Can you supply an example of a failure case that can’t be solved (or is at least challenging to solve)?
sweetjuly•5h ago
sbrk grows linearly, and if anything is mapped in the way it fails. mmap can map anywhere there's space as it is not restricted to linear mappings. So, you'd better hope a mapping doesn't randomly land there and run you out of space.

It's not a failure but relatedly as sbrk is linear, you also don't really have a reasonable way to deal with fragmentation. For example, suppose you allocate 1000 page sized objects and then free all but the last one. With an mmap based heap, you can free all 999 other pages back to the OS whereas with sbrk you're stuck with those 999 pages you don't need for the lifetime of that 1000th object (better hope it's not long lived!).

Really, sbrk only exists for legacy reasons.

ori_b•4h ago
> With an mmap based heap, you can free all 999 other pages back to the OS whereas with sbrk you're stuck with those 999 pages you don't need for the lifetime of that 1000th object (better hope it's not long lived!).

Thanks to the wonders of virtual memory, you can madvise(MADV_DONTNEED), and return the memory to the OS, without giving up the address space.

squirrellous•4h ago
Not giving up the address space feels like an anti feature. This would mean, among other things, that access to the DONTNEED memory is no longer a segfault but garbage values instead, which is not ideal.
checker659•5h ago
That project structure is reminding me of claude.
keyle•5h ago
So does half the readme
leecommamichael•3h ago
Which part?
gameman144•3h ago
Could you elaborate? The project structure looks extremely normal to me, but I don't know if I'm overlooking red flags all over the place.
checker659•2h ago
The structure in the README.md (not the actual structure).
leecommamichael•3h ago
Personally I’d not bother with folders, but to each their own. I’m sorry but I just don’t see what you’re onto.
AdieuToLogic•5h ago
Why redeclare the function signatures in allocator.h[0] when they must match what is already defined by the C standard?

Since this is all allocator.h[0] contains aside from other include statements, why have allocator.h at all?

0 - https://github.com/t9nzin/memory/blob/main/include/allocator...

leecommamichael•3h ago
Why write a mini allocator?
Subsentient•4h ago
As soon as I saw mmap(), I knew this wasn't a true native allocator. So yeah, not quite so insightful after all.
vintagedave•4h ago
It’s a ‘minimal’ allocator. Reading the blog it seems to be going in depth into allocator principles, in practice, things like coalescing blocks.

I haven’t read in full so not sure if it discusses using blocks vs other structures (eg stack-based allocators, stack being the data structure not the program stack.) Ie, it’s a set of implementation choices. It still seems to reflect common ways of allocating in far more detail than many blogs I’ve read on the topic do.

leecommamichael•3h ago
Your comment reads as if you believe that simply writing the syscall C wrapper yourself would constitute a meaningful enhancement to the code. We can all apply more effort to be insightful.
canyp•3h ago
I always like me some memory allocator blog/code. Two links in the context of gamedev below, in case you or anyone else is interested.

https://screwjankgames.github.io/engine%20programming/2020/0...

https://www.bytesbeneath.com/p/the-arena-custom-memory-alloc...

I also don't know how much we want to butcher this blog post, but:

> RAM is fundamentally a giant array of bytes, where each byte has a unique address. However, CPUs don’t fetch data one byte at a time. They read and write memory in fixed-size chunks called words which are typically 4 bytes on 32-bit systems or 8 bytes on 64-bit systems.

CPUs these days fetch entire cache lines. Memory is also split into banks. There are many more details involved, and it is viewing memory as a giant array of bytes that is fundamentally broken. It's a useful abstraction up until some point, but it breaks apart once you analyze performance. This part of the blog didn't seem very accurate.

rurban•2h ago
One line: bump sbrk(). Done.

No need to free in short living processes