Doug Lea's malloc became Linux's default allocator and nobody even named it

Doug Lea's malloc became Linux's default allocator and nobody even named it

Doug Lea started writing a memory allocator in 1987 after his C++ programs ran slower and consumed more memory than expected on SunOS and BSD. The result, dlmalloc, became the default native malloc in some Linux versions and was compiled into many packages. Lea explains the design goals—compatibility, portability, space and time efficiency, tunability, locality, and error detection—and the trade-offs behind boundary tags, size-sorted bins, and best-fit with coalescing.

For an extreme example, among the fastest possible versions of malloc() is one that always allocates the next sequential memory location available on the system, and the corresponding fastest version of free() is a no-op. However, such an implementation is hardly ever acceptable: it will cause a program to run out of memory quickly since it never reclaims unused space.
  1. senderista

    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/...

  2. asveikau

    In the mid 2000s I was a student in upstate NY and I very briefly met Doug Lea. (I'm 100% sure he doesn't remember me at all.) He was a very warm, approachable, down to earth guy. The computer labs at Oswego had a bunch of giant Sun Microsystems logos on all the gear, I guess because they were funding him.

  3. acyclic

    The only algorithm to be named after someone's full name, first and last name

More from this day

2026-11-29