diff options
author | Todd Lipcon <todd@cloudera.com> | 2018-03-17 09:43:34 -0700 |
---|---|---|
committer | Todd Lipcon <todd@cloudera.com> | 2018-03-17 09:46:28 -0700 |
commit | db98aac55a90d45e9abe188c8a928c3561d3f223 (patch) | |
tree | 2dea429bb8709e746ca83a5a73a13296757a6209 /docs | |
parent | d7be9385609328a03c5cfe775473a7dc8e014fd3 (diff) | |
download | gperftools-db98aac55a90d45e9abe188c8a928c3561d3f223.tar.gz |
Add a central free list for kMaxPages-sized spans
Previously, the central free list with index '0' was always unused,
since freelist index 'i' tracked spans of length 'i' and there are no
spans of length 0. This meant that there was no freelist for spans of
length 'kMaxPages'. In the default configuration, this corresponds to
1MB, which is a relatively common allocation size in a lot of
applications.
This changes the free list indexing so that index 'i' tracks spans of
length 'i + 1', meaning that free list index 0 is now used and
freelist[kMaxPages - 1] tracks allocations of kMaxPages size (1MB by
default).
This also fixes the stats output to indicate '>128' for the large spans
stats rather than the incorrect '>255' which must have referred to a
historical value of kMaxPages.
No new tests are added since this code is covered by existing tests.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/pageheap.dot | 4 | ||||
-rw-r--r-- | docs/pageheap.gif | bin | 5915 -> 5942 bytes | |||
-rw-r--r-- | docs/tcmalloc.html | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/docs/pageheap.dot b/docs/pageheap.dot index ac84b90..5e9aec8 100644 --- a/docs/pageheap.dot +++ b/docs/pageheap.dot @@ -3,7 +3,7 @@ rankdir=LR node [shape=box, width=0.3, height=0.3] nodesep=.05 -heap [shape=record, height=3, label="<f0>1 page|<f1>2 pages|<f2>3 pages|...|<f127>127 pages"] +heap [shape=record, height=3, label="<f0>1 page|<f1>2 pages|<f2>3 pages|...|<f128>128 pages"] O0 [shape=record, label=""] O1 [shape=record, label=""] O2 [shape=record, label="{|}"] @@ -20,6 +20,6 @@ sep4 [shape=plaintext, label="..."] heap:f0 -> O0 -> O1 -> sep1 heap:f1 -> O2 -> O3 -> sep2 heap:f2 -> O4 -> O5 -> sep3 -heap:f127 -> O6 -> O7 -> sep4 +heap:f128 -> O6 -> O7 -> sep4 } diff --git a/docs/pageheap.gif b/docs/pageheap.gif Binary files differindex 76b62e8..5cf00bd 100644 --- a/docs/pageheap.gif +++ b/docs/pageheap.gif diff --git a/docs/tcmalloc.html b/docs/tcmalloc.html index 62dae72..33b8cc5 100644 --- a/docs/tcmalloc.html +++ b/docs/tcmalloc.html @@ -201,7 +201,7 @@ to see how it affects the <code>max_length</code>. <p>A medium object size (256K ≤ size ≤ 1MB) is rounded up to a page size (8K) and is handled by a central page heap. The central page heap includes an array of 128 free lists. The <code>k</code>th entry is a -free list of runs that consist of <code>k</code> pages:</p> +free list of runs that consist of <code>k + 1</code> pages:</p> <center><img src="pageheap.gif"></center> <p>An allocation for <code>k</code> pages is satisfied by looking in |