diff options
author | Jason Evans <je@fb.com> | 2015-01-22 23:28:25 (GMT) |
---|---|---|
committer | Jason Evans <je@fb.com> | 2015-01-22 23:28:25 (GMT) |
commit | 228b2e92421d8cc7990e931e3144b6f1c3398501 (patch) | |
tree | 2ba349aa3ba251515a30038f8d80de5cbf390730 /doc | |
parent | 10aff3f3e1b8b3ac0348b259c439c9fe870a6b95 (diff) | |
download | jemalloc-228b2e92421d8cc7990e931e3144b6f1c3398501.zip jemalloc-228b2e92421d8cc7990e931e3144b6f1c3398501.tar.gz jemalloc-228b2e92421d8cc7990e931e3144b6f1c3398501.tar.bz2 |
Document under what circumstances in-place resizing succeeds.
This resolves #100.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/jemalloc.xml.in | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in index 0148f03..858572d 100644 --- a/doc/jemalloc.xml.in +++ b/doc/jemalloc.xml.in @@ -533,6 +533,22 @@ for (i = 0; i < nbins; i++) { nearest multiple of the cacheline size, or specify cacheline alignment when allocating.</para> + <para>The <function>realloc<parameter/></function>, + <function>rallocx<parameter/></function>, and + <function>xallocx<parameter/></function> functions may resize allocations + without moving them under limited circumstances. Unlike the + <function>*allocx<parameter/></function> API, the standard API does not + officially round up the usable size of an allocation to the nearest size + class, so technically it is necessary to call + <function>realloc<parameter/></function> to grow e.g. a 9-byte allocation to + 16 bytes, or shrink a 16-byte allocation to 9 bytes. Growth and shrinkage + trivially succeeds in place as long as the pre-size and post-size both round + up to the same size class. No other API guarantees are made regarding + in-place resizing, but the current implementation also tries to resize large + and huge allocations in place, as long as the pre-size and post-size are + both large or both huge. In such cases shrinkage always succeeds, but + growth only succeeds if the trailing memory is currently available.</para> + <para>Assuming 4 MiB chunks, 4 KiB pages, and a 16-byte quantum on a 64-bit system, the size classes in each category are as shown in <xref linkend="size_classes" xrefstyle="template:Table %n"/>.</para> |