Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 3 Jan 2014 13:19:06 -0500
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: Re: Removing sbrk and brk

On Fri, Jan 03, 2014 at 12:33:01PM -0500, Rich Felker wrote:
> hodge-podge of copy-and-paste from various legacy code. I suspect
> omalloc is considerably higher quality than a lot of the things those
> two implementations copied, but from casual inspection, it doesn't
> look anywhere near as small or high-performance as musl's.
> 
> > http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c

Quick summary of omalloc:

- Uses mmap directly for allocations of at least PAGE_SIZE (vs musl
  which only uses mmap directly past 128k/256k limit).

- Rounds all allocation sizes up to a power of 2 (vs musl which has
  exact sizes for all mod-16-aligned sizes up to 512 bytes, or
  mod-32-aligned up to 1024 bytes on 64-bit, and above that every 1/4
  unit between successive powers of 2).

- Global lock (vs musl which uses local, per-bin locks, allowing
  allocations of different sizes not to touch the same locks).

- Allocations smaller than PAGE_SIZE are made by allocating a whole
  page of same-size objects that cannot be merged or resized in-place
  (vs musl which splits and combines free ranges as needed from a
  large, growable heap).

Overall my assessment is that omalloc is _simple_ (in some ways
simpler than musl's), but looks to have much worse fragmentation
properties, much worse performance properties (both syscall overhead
and locking come to mind), and no other clear advantages.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.