summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2014-08-28 19:41:48 (GMT)
committerJason Evans <je@fb.com>2014-09-09 00:34:24 (GMT)
commit4cfe55166e0173be745c53adb0fecf50d11d1227 (patch)
tree68748ac2c268a1c7940395eaf637f2d36ec15d55 /doc
parentc3f865074923bf388742da3ec52dca857a0960a2 (diff)
downloadjemalloc-4cfe55166e0173be745c53adb0fecf50d11d1227.zip
jemalloc-4cfe55166e0173be745c53adb0fecf50d11d1227.tar.gz
jemalloc-4cfe55166e0173be745c53adb0fecf50d11d1227.tar.bz2
Add support for sized deallocation.
This adds a new `sdallocx` function to the external API, allowing the size to be passed by the caller. It avoids some extra reads in the thread cache fast path. In the case where stats are enabled, this avoids the work of calculating the size from the pointer. An assertion validates the size that's passed in, so enabling debugging will allow users of the API to debug cases where an incorrect size is passed in. The performance win for a contrived microbenchmark doing an allocation and immediately freeing it is ~10%. It may have a different impact on a real workload. Closes #28
Diffstat (limited to 'doc')
-rw-r--r--doc/jemalloc.xml.in19
1 files changed, 18 insertions, 1 deletions
diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in
index 8f4327f..e5c229f 100644
--- a/doc/jemalloc.xml.in
+++ b/doc/jemalloc.xml.in
@@ -38,6 +38,7 @@
<refname>xallocx</refname>
<refname>sallocx</refname>
<refname>dallocx</refname>
+ <refname>sdallocx</refname>
<refname>nallocx</refname>
<refname>mallctl</refname>
<refname>mallctlnametomib</refname>
@@ -121,6 +122,12 @@
<paramdef>int <parameter>flags</parameter></paramdef>
</funcprototype>
<funcprototype>
+ <funcdef>void <function>sdallocx</function></funcdef>
+ <paramdef>void *<parameter>ptr</parameter></paramdef>
+ <paramdef>size_t <parameter>size</parameter></paramdef>
+ <paramdef>int <parameter>flags</parameter></paramdef>
+ </funcprototype>
+ <funcprototype>
<funcdef>size_t <function>nallocx</function></funcdef>
<paramdef>size_t <parameter>size</parameter></paramdef>
<paramdef>int <parameter>flags</parameter></paramdef>
@@ -228,7 +235,8 @@
<function>rallocx<parameter/></function>,
<function>xallocx<parameter/></function>,
<function>sallocx<parameter/></function>,
- <function>dallocx<parameter/></function>, and
+ <function>dallocx<parameter/></function>,
+ <function>sdallocx<parameter/></function>, and
<function>nallocx<parameter/></function> functions all have a
<parameter>flags</parameter> argument that can be used to specify
options. The functions only check the options that are contextually
@@ -312,6 +320,15 @@
memory referenced by <parameter>ptr</parameter> to be made available for
future allocations.</para>
+ <para>The <function>sdallocx<parameter/></function> function is an
+ extension of <function>dallocx<parameter/></function> with a
+ <parameter>size</parameter> parameter to allow the caller to pass in the
+ allocation size as an optimization. The minimum valid input size is the
+ original requested size of the allocation, and the maximum valid input
+ size is the corresponding value returned by
+ <function>nallocx<parameter/></function> or
+ <function>sallocx<parameter/></function>.</para>
+
<para>The <function>nallocx<parameter/></function> function allocates no
memory, but it performs the same size computation as the
<function>mallocx<parameter/></function> function, and returns the real