Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Hacking OpenAI(hacktron.ai ↗)
    122comments
  2. Jemalloc 5.4.0(github.com/jemalloc ↗)
    18comments
  3. Astra for Law(openai.com ↗)
    488comments
  4. The scourge of x86 emulation(fex-emu.com ↗)
    9comments
  5. Bonsai 2 27B: Near-Lossless Compression in a 9x Smaller Footprint(prismml.com ↗)
    118comments
  6. Bend – A language that blocks AI mistakes via proof, on CPU and GPU(bend-lang.com ↗)
    205comments
  7. Qwen 3.8 Omni Flash(qwen.ai ↗)
    60comments
  8. Pre-Greek: The lost language hidden within Ancient Greek(linguisticdiscovery.com ↗)
    25comments
  9. Hister: A private search engine for the pages you visit and the files you keep(github.com/asciimoo ↗)
    159comments
  10. Wax motor(wikipedia.org ↗)
    63comments
  11. Fujitsu launches made-in-Japan next-generation CPU FUJITSU-MONAKA(global.fujitsu ↗)
    221comments
  12. Shapelearn Qwen 3.8 27B (13.1 GB VRAM)(byteshape.com ↗)
    5comments
  13. When the fractional part of a float fixes your shader(crocidb.com ↗)
    discuss
  14. How to Write with an LLM(sockpuppet.org ↗)
    81comments
  15. Telstra outage: The night a network decided the year was 2006(netnod.se ↗)
    21comments
  16. Flet 1.0 – Build cross-platform apps in Python(flet.dev ↗)
    51comments
  17. Apple detectives solved mystery of ancient tree and rewrote the history of fruit(scientificamerican.com ↗)
    4comments
  18. Ask A Monk – A digital wilderness for thoughts with no immediate answer(askamonk.online ↗)
    20comments
  19. Diplodocus, Long Thought Exclusively American, Turns Up in Spain(sci.news ↗)
    36comments
  20. The most important product decision is what you don't build(liamnugent.me ↗)
    32comments
  21. Fixing an NZXT Signal 4K30 part 2: the green/pink video bug(downtowndougbrown.com ↗)
    8comments
  22. Waymo in Singapore(waymo.com ↗)
    107comments
  23. CrowdSec Source Code Leak(crowdsec.net ↗)
    44comments
  24. How do we prevent mathemathics from devolving into the Medieval Era of secrecy?(mathoverflow.net ↗)
    94comments
  25. Why I didn’t sign the Fields medallists’ letter(gowers.wordpress.com ↗)
    354comments
  26. How Uber Protects Against Retry Storms(uber.com ↗)
    35comments
  27. Show HN: Snapdrop: Instantly share files between devices. No setup, no signup(snapdrop.me ↗)
    34comments
  28. Infinite-Parameter LLMs: Generating and Adapting Weights from Live Data(arxiv.org ↗)
    39comments
  29. Khipu (Quipu) Field Guide(khipufieldguide.com ↗)
    discuss
  30. Code Scans(devin.ai ↗)
    4comments

Comparison of Malloc() Algorithms

136 pointsby 2d agoegbert.net
39 comments
1d agoHN ↗

ERR_SSL_VERSION_OR_CIPHER_MISMATCH on my phone it seems?

22h agoHN ↗

TLS_CHACHA20_POLY1305_SHA256 (256 bit keys, TLS 1.3) successfully negotiated here (Firefox esr 140.14.0).

1d agoHN ↗

https://web.archive.org/web/20260915165314/https://egbert.ne...

Funny SSL setup. Explanation from here https://news.ycombinator.com/item?id=49133598

Oh, certain browser will not work with this blog if it cannot negotiate ONLY for Cha-Cha/Poly. It's by design as a showcase of why that particular web browser refuses to do that.

I assume the "particular web browser" is Chromium, which won't load it on any OS I've tried. On Windows, Firefox and the built-in curl.exe also refuse to connect.

20h agoHN ↗

A great idea for another article. A focus, on embedded and malloc()

I do do have a malloc() benchmark but it is in bad shape and directories have not coalesce nicely yet, tor a single run or a menu-driven one.

20h agoHN ↗

It keeps certain web scrapers and inline transparent proxies/IDS/XNS from fetching, 100%

Certain browsers will suffer. Meh.

19h agoHN ↗

Firefox on Windows user here, and it loads the blog fine. I don't have Chrome installed but Edge (which is Chromium engine based) doesn't load it.

52m agoHN ↗

I don't get what this is supposed to prove. That my browser doesn't allow websites to declare what encryption they use? I am pretty sure there's a point to all of this, but please let me (and my browser) choose which encryptions I want to trust.

Is this a spec violation or something?

23h agoHN ↗

It seems to be intentional & if somebody wants to make a statement about TLS with their personal website that's their choice to make and execute.

21h agoHN ↗

On the bright side, lots of people will be saved from reading bad prose like "Malloc (libc) is the worst memory allocation API to use" and "Programs should avoid, if possible, allocating/deallocating memory too often". (By definition, "too often" means it can possibly be avoided, and usually that it can practically be avoided.)

17h agoHN ↗

Beats the hell out of most of the LLM-generated "honest assesments" of things on this site.

15h agoHN ↗

I might be stupid, but what's wrong with those sentences?

23h agoHN ↗

Not a good article, IMO.

FTA: “When multiple threads simultaneously allocate or deallocate memory from the allocator, the allocator will serialize them. Programs making intensive use of the allocator actually slow down as the number of processors increases.”

The article does later retract on that, but that’s no reason to lead with such a blatantly false (with current allocators) statement.

Also FTA “In 2006, a third pool was introduced (after operating system memory pool and library-based memory pool) called the “arena”. Arena is a jemalloc-term”

Jemalloc is from around 2005 (http://jemalloc.net/), the idea of arenas is from the 1960s, and Wikipedia claims the term was coined in 1990 (https://en.wikipedia.org/wiki/Region-based_memory_management...), and the linked paper (https://www.cs.princeton.edu/techreports/1988/191.pdf) is from 1988.

Then, a typo: “as well as memory tied to specific to each of the multiple CPU core or even CPU infinity.”

“Infinity” should be “affinity” there.

23h agoHN ↗

The tables look mostly correct, and that's what I'll be bookmarking this for… I don't think I've seen any elsewhere that are this extensive (in both axis, total allocators covered & details per allocator).

20h agoHN ↗

Thank you.

I got tired of reading AI prose so I compiled and wrote it from my collections of others' whitepapers.

As a "For Reference Only", at the very least, for me.

As usual, anyone is welcome to improve upon it under CC BY-NC-SA.

21h agoHN ↗

yup and the characterization of each allocator is so fuzzy, with zero methodology provided.

allocators are so simple to just swap into your program. if you can put together a few representative workloads, you should just try out a few allocators and profile whatever metrics you care about.

20h agoHN ↗

And finally end up with either jemalloc or possibly mimalloc. ;)

20h agoHN ↗

Invariably so but I'm mulling over malloc()s on embedded topic now.

1h agoHN ↗

Interesting, is there an accompanying article?

We've tried tcmalloc, too. I don't remember the exact details, but we basically ended using jemalloc because it was using way less memory.

Same story with mimalloc - it usually provided a tiny bit more speed, but required more cpu and memory.

19h agoHN ↗

ClickHouse has been tested with jemalloc, mimalloc, tcmalloc (both variants), rpmalloc, lfalloc, hualloc, and ended up using jemalloc after a few patches and bug fixes.

18h agoHN ↗

Lfmalloc? Humalloc?

I am intrigued.

Is there a source for them?

20h agoHN ↗

Thank you for the critique.

Compilations are hard to get 100% right.

19h agoHN ↗

Yes, I do not know what this paragraph wants to say:

"The first memory allocation scheme started with a stack-based memory allocation. Next came the dynamic-based memory allocation scheme where linked-list and bucket-heap mechanism are used to divide the private-heap using size class approach. Soon, garbage collection algorithm introduced the initial backend of the memory allocation scheme."

Since no specific operating system is mentioned, these sentences appear to refer to the general history of dynamic memory allocation, in which case they are wrong.

"malloc" is a late comer in this history. It has appeared as the statement "ALLOCATE", together with the statement "FREE", in the programming language PL/I of IBM, by the end of 1964. The C programming language has inherited these 2 functions from IBM PL/I, together with several other features.

At that time (1964-12), many other techniques of managing memory had already been used for a few years.

Dynamic allocation of memory has started during the fifties, with allocation without ever freeing the allocated memory before the termination of the process.

Then, in 1960, 3 methods of handling dynamic memory allocation and implicit freeing were published, which have remained important until today: the use of garbage collectors in April (John McCarthy), the use of stacks in May (E. W. Dijkstra), and the use of reference counts in December (George E. Collins @ IBM).

So the use of garbage collectors is actually the oldest published method for handling dynamic memory allocation, not a newer method, being used in LISP I about 5 years before the first release of PL/I with explicit allocation and freeing (mid 1965).

16h agoHN ↗

Thank you for the insightful aspect. This too should be in the lore of memory allocations as well

Will research that, citations and all

14h agoHN ↗

To help you with the citations:

Garbage collectors: "Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I", John McCarthy, Communications of the ACM, 1960-04, pp. 184-195 (open access at ACM).

Stacks and stack pointers: "Recursive Programming", Edsger Wybe Dijkstra, 1960-05-11 (available at the Dijkstra Archive).

Reference counts for memory allocation: "A Method for Overlapping and Erasure of Lists", George E. Collins (IBM), Communications of the ACM, Volume 3, Issue 12, 1960-12, pp. 655–657 (open access at ACM).

The first "malloc", i.e. the statements "ALLOCATE" and "FREE" appeared in "NPL Technical Report" at IBM in 1964-12 (available at bitsavers.org).

"NPL" was a provisional name for the new programming language of IBM, which was rebranded as "PL/I" when it was launched officially, a half of year later.

IBM did not document what kind of algorithm was used by their "malloc" implementation, but it already had to handle multi-threaded programs and it was specified that when a new thread was spawned, it could still access any variable that had been dynamically allocated in the parent thread, before the launching of the new thread, but the variables that were allocated in the new thread were private to that thread.

The C "malloc" became compatible with multi-threading only many decades after its ancestor from PL/I.

10h agoHN ↗

Zeow! Citation galore! Gotta RAG them into my LLM!

And then THeIR citations too!

Thank you very much!

19h agoHN ↗

Couldn't read the article (ERR_SSL_VERSION_OR_CIPHER_MISMATCH, Chrome on Windows). But I'm remembering something a coworker told me some time around... 1991 to 1993, maybe? Forgive me if I repeat some of what the article says - I did try to read it!

While he was at the university, they were experimenting with different kind of mallocs. One was called the "buddy" malloc. It kept a list of free blocks of various sizes, and when you asked for a block and it didn't have one, it asked the OS for twice as much as you asked for. From the rest, it made another block (identical to yours, called the "buddy" block), and put it on the free list of that size.

Well, they experimented with a similar algorithm, but the idea was that most requests were small. So it took the buddy block and broke it into smaller pieces, one half the size of the request, one a quarter the size, and so on, and put those on their respective free lists. They called this the "donner" malloc, because you carved up your buddy.

From the way my coworker smiled, I think he thought it was amusing, but I don't think he was making it up.

18h agoHN ↗

D. S. Hirschberg, A Class of Dynamic Memory Allocation, CACM 16(10) 1973 covered this variants of halving Buddy Allocator.

14h agoHN ↗

What malloc does macOS use in userspace? How about kernel?

10h agoHN ↗

In NextSTEP 3, it was zoned-based allocation.

Rhapsody and early MacOS X, Darwin also used zone-based

Early iPhone also zone-based.

Later MacOS X implemented scalable zone, magazine allocator.

iPhone 12+ then went Nano allocator, ScalableZone + large/VM allocator

Latest iOS/iPadOS use Nano2

8h agoHN ↗

Every time I tried to replace the allocator in an app, the speedup was negligible.