~ubuntu-branches/ubuntu/trusty/musl/trusty-proposed

« back to all changes in this revision

Viewing changes to src/malloc/DESIGN

  • Committer: Package Import Robot
  • Author(s): Kevin Bortis
  • Date: 2013-09-20 20:54:14 UTC
  • Revision ID: package-import@ubuntu.com-20130920205414-5b61trtmma18w58o
Tags: upstream-0.9.13
ImportĀ upstreamĀ versionĀ 0.9.13

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
 
 
3
In principle, this memory allocator is roughly equivalent to Doug
 
4
Lea's dlmalloc with fine-grained locking.
 
5
 
 
6
 
 
7
 
 
8
malloc:
 
9
 
 
10
Uses a freelist binned by chunk size, with a bitmap to optimize
 
11
searching for the smallest non-empty bin which can satisfy an
 
12
allocation. If no free chunks are available, it creates a new chunk of
 
13
the requested size and attempts to merge it with any existing free
 
14
chunk immediately below the newly created chunk.
 
15
 
 
16
Whether the chunk was obtained from a bin or newly created, it's
 
17
likely to be larger than the requested allocation. malloc always
 
18
finishes its work by passing the new chunk to realloc, which will
 
19
split it into two chunks and free the tail portion.
 
20
 
 
21
 
 
22