frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

OpenCiv3: Open-source, cross-platform reimagining of Civilization III

https://openciv3.org/
367•klaussilveira•4h ago•76 comments

The Waymo World Model

https://waymo.com/blog/2026/02/the-waymo-world-model-a-new-frontier-for-autonomous-driving-simula...
736•xnx•10h ago•451 comments

Show HN: Look Ma, No Linux: Shell, App Installer, Vi, Cc on ESP32-S3 / BreezyBox

https://github.com/valdanylchuk/breezydemo
127•isitcontent•4h ago•13 comments

Monty: A minimal, secure Python interpreter written in Rust for use by AI

https://github.com/pydantic/monty
103•dmpetrov•5h ago•48 comments

A century of hair samples proves leaded gas ban worked

https://arstechnica.com/science/2026/02/a-century-of-hair-samples-proves-leaded-gas-ban-worked/
47•jnord•3d ago•3 comments

Show HN: I spent 4 years building a UI design tool with only the features I use

https://vecti.com
230•vecti•6h ago•108 comments

Dark Alley Mathematics

https://blog.szczepan.org/blog/three-points/
17•quibono•4d ago•0 comments

Microsoft open-sources LiteBox, a security-focused library OS

https://github.com/microsoft/litebox
300•aktau•11h ago•148 comments

Sheldon Brown's Bicycle Technical Info

https://www.sheldonbrown.com/
300•ostacke•10h ago•80 comments

Show HN: If you lose your memory, how to regain access to your computer?

https://eljojo.github.io/rememory/
151•eljojo•7h ago•116 comments

Hackers (1995) Animated Experience

https://hackers-1995.vercel.app/
370•todsacerdoti•12h ago•214 comments

Show HN: R3forth, a ColorForth-inspired language with a tiny VM

https://github.com/phreda4/r3
41•phreda4•4h ago•7 comments

An Update on Heroku

https://www.heroku.com/blog/an-update-on-heroku/
299•lstoll•11h ago•222 comments

I spent 5 years in DevOps – Solutions engineering gave me what I was missing

https://infisical.com/blog/devops-to-solutions-engineering
98•vmatsiiako•9h ago•32 comments

How to effectively write quality code with AI

https://heidenstedt.org/posts/2026/how-to-effectively-write-quality-code-with-ai/
164•i5heu•7h ago•119 comments

Learning from context is harder than we thought

https://hy.tencent.com/research/100025?langVersion=en
134•limoce•3d ago•75 comments

Understanding Neural Network, Visually

https://visualrambling.space/neural-network/
221•surprisetalk•3d ago•29 comments

FORTH? Really!?

https://rescrv.net/w/2026/02/06/associative
32•rescrv•12h ago•14 comments

I now assume that all ads on Apple news are scams

https://kirkville.com/i-now-assume-that-all-ads-on-apple-news-are-scams/
949•cdrnsf•14h ago•409 comments

The Oklahoma Architect Who Turned Kitsch into Art

https://www.bloomberg.com/news/features/2026-01-31/oklahoma-architect-bruce-goff-s-wild-home-desi...
15•MarlonPro•3d ago•2 comments

I'm going to cure my girlfriend's brain tumor

https://andrewjrod.substack.com/p/im-going-to-cure-my-girlfriends-brain
21•ray__•1h ago•3 comments

Claude Composer

https://www.josh.ing/blog/claude-composer
90•coloneltcb•2d ago•65 comments

Show HN: Smooth CLI – Token-efficient browser for AI agents

https://docs.smooth.sh/cli/overview
76•antves•1d ago•56 comments

Evaluating and mitigating the growing risk of LLM-discovered 0-days

https://red.anthropic.com/2026/zero-days/
31•lebovic•1d ago•10 comments

Show HN: Slack CLI for Agents

https://github.com/stablyai/agent-slack
36•nwparker•1d ago•7 comments

How virtual textures work

https://www.shlom.dev/articles/how-virtual-textures-really-work/
22•betamark•11h ago•21 comments

The Beauty of Slag

https://mag.uchicago.edu/science-medicine/beauty-slag
26•sohkamyung•3d ago•3 comments

Evolution of car door handles over the decades

https://newatlas.com/automotive/evolution-car-door-handle/
37•andsoitis•3d ago•59 comments

Planetary Roller Screws

https://www.humanityslastmachine.com/#planetary-roller-screws
33•everlier•3d ago•6 comments

Masked namespace vulnerability in Temporal

https://depthfirst.com/post/the-masked-namespace-vulnerability-in-temporal-cve-2025-14986
29•bmit•6h ago•3 comments
Open in hackernews

Show HN: I wrote a minimal memory allocator in C

https://github.com/t9nzin/memory
137•t9nzin•2mo 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•2mo 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.

p2detar•2mo ago
Indeed. To me it still looks kind of fishy, because the author doesn't have a single other C project on github. The blog post reference is the only thing that makes it somewhat legit, to me at least.
achierius•2mo 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•2mo ago
Can you supply an example of a failure case that can’t be solved (or is at least challenging to solve)?
sweetjuly•2mo 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•2mo 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•2mo 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.
jlokier•2mo ago
> 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

Actually... you can free those 999 sbrk() pages using munmap() on Linux and Darwin (so most likely the BSDs too). You can also change the mappings within the sbrk()-allocated range, much like any other mmap.

This feature is not well known, nor particularly useful :-)

checker659•2mo ago
That project structure is reminding me of claude.
keyle•2mo ago
So does half the readme
leecommamichael•2mo ago
Which part?
gameman144•2mo 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•2mo ago
The structure in the README.md (not the actual structure).
leecommamichael•2mo 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•2mo 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•2mo ago
Why write a mini allocator?
AdieuToLogic•2mo ago
> Why write a mini allocator?

Lots of reasons.

Leveraging platform-specific functionality, enabling use in embedded systems, as a learning exercise, etc.

What is not needed is a header file which redeclares the same C standard function signatures defined by the replacement allocator.

matheusmoreira•2mo ago
Why match the C standard at all? The C standard library is not really a shining example of API design.

It's interesting to brainstorm new memory allocation interfaces. Some cool ideas:

https://nullprogram.com/blog/2023/12/17/

https://gist.github.com/o11c/6b08643335388bbab0228db763f9921...

I'm in a position to do this in my programming language project. Wrote my own allocator for it. Maybe it's time to reinvent a better wheel.

AdieuToLogic•2mo ago
> Why match the C standard at all?

The referenced header file is defined thusly:

  #include <stddef.h>
  #include <stdbool.h>
  
  void *malloc(size_t size);
  void *calloc(size_t n, size_t size);
  void *realloc(void *ptr, size_t size);
  void free(void *ptr);
These function declarations are equivalent to those defined by the C standard due their being "drop-in" replacements. Therefore, reproducing same is unneeded.

> I'm in a position to do this in my programming language project. Wrote my own allocator for it. Maybe it's time to reinvent a better wheel.

Wonderful.

But if your intent is to replace the aforementioned C standard library memory allocation functions, then they would have to have the same signatures of the functions being replaced. Which leads back to the original assertion that there is no need for a header file which declares the same C functions defined by the C standard library for which they replace.

canyp•2mo 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.

writebetterc•2mo ago
In a single-threaded context, I think 'giant array array of bytes' is still correct? Performance, not so much.

> This part of the blog didn't seem very accurate.

It was a sufficient amount of understanding to produce this allocator :-). I think that if we have beginner[0] projects posted and upvoted, we must understand that the author's understanding may be lacking some nuance.

[0] author might be a very good programmer, just not familiar with this particular area!

canyp•2mo ago
I brought that up for their further reading since that part seemed to be the weakest part of the post.

I think this is good work anyway.

degamad•2mo ago
> author might be a very good programmer, just not familiar with this particular area

Or even, they may be familiar, but challenging their understanding or using simplifying assumptions to reduce complexity.

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

No need to free in short living processes

matheusmoreira•2mo ago
The fastest garbage collector algorithm is similar. Just keep allocating new objects. Just don't bother with actually collecting garbage. Just leak all that memory.

Perfectly usable in many applications. Unfortunately, since it depends on assumptions about the application, it's not really suited for a general purpose library.

unwind•2mo ago
This looked nice and simple, appreciated!

A couple of minor C points:

- The code seems to completely lack use of `static` for things that should be local to the implementation, such as `META_SIZE`, `find_free_block()` and others.

- The header includes `<stdbool.h>` but the interface doesn't use it so it could be included in the C file instead (which, in fact, it is!).

- Could do with more `const` for clarity, but that is quite personal.

- Interesting to use explicit comparison to check for integers being zero, but treat pointers being NULL as implicit boolean. I prefer comparing in both cases.

halayli•2mo ago
This is not a good idea. You're venturing in the unspecified/non-portable behavior territory.

https://pubs.opengroup.org/onlinepubs/7908799/xsh/brk.html

> The behaviour of brk() and sbrk() is unspecified if an application also uses any other memory functions (such as malloc(), mmap(), free()). Other functions may use these other memory functions silently.

teo_zero•2mo ago
Well done!

My remarks:

1) in calloc() you correctly check size*n against SIZE_MAX, but in multiple other spots you don't check size+META_SIZE.

2) the field is_mmap is useless: it can be replaced by (size>=MMAP_THRESHOLD) practically everywhere. The only corner case where this doesn't work is a large block initially backed by mmap() that's then shrunk via realloc() to under the threshold. But realloc() has other inconsistencies anyway, see next point.

3) realloc() shows the signs of a refactoring gone wild. The first if on block->size lacks a test on is_mmap, as split_block() doesn't seem to do the right thing with mmapped blocks...

4) free_list does not in fact track free nodes, as its name suggests, but all nodes, whether they are free or not. Wouldn't it be better to add a node to the list only when it's freed? I leave to you to iron out all the corner cases!