An unofficial, read-only Hacker News reader.

Doug Lea's Malloc (opens external site)

34 points by grep_it 3 days ago | gee.cs.oswego.edu | 16 comments on HN

View full thread · View on Hacker News

Comment thread (6)

  1. It was a good single-threaded allocator back in the day but in the multicore era the design is now thoroughly obsolete. I suggest reading e.g. the jemalloc[1] and mimalloc[2] papers if you want to understand how modern allocators are implemented.

    [1] https://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemal...

    [2] https://www.microsoft.com/en-us/research/wp-content/uploads/...

    Replies (3)
    1. Considering that global allocators are usually an anti-pattern and that most applications should have component-specific allocators, dlmalloc isn't all that bad when used through its mspace API. Of course, if one doesn't actually need a general allocator, they should simply use an arena allocator.
      Replies (1)
      1. Musl still supports single threaded slab allocations. In Musl, the difference comes down to one lock, some atomics, and a #define. My library extracts out its algorithm and let's you use scoped single and multi threaded Musl allocators freely mixed with each other.
    2. Has anyone tried jev as an allocator?
      Replies (1)
      1. Brilliant. "End-to-end response time is 70ms-500ms for TypeSafe." https://typesafe.ai/blog/introducing-system-one-models-and-j... That could work for some use cases.
    3. Cosmopolitan uses dlmalloc and just wraps it with an rseq allocator for multicore performance. See also https://jart.dev/rseq/