89 lines
18 KiB
HTML
89 lines
18 KiB
HTML
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `jemalloc_sys` crate."><meta name="keywords" content="rust, rustlang, rust-lang, jemalloc_sys"><title>jemalloc_sys - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../jemalloc_sys/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Crate jemalloc_sys</p><div class="sidebar-elems"><a id='all-types' href='all.html'><p>See all jemalloc_sys's items</p></a><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#constants">Constants</a></li><li><a href="#statics">Statics</a></li><li><a href="#functions">Functions</a></li><li><a href="#types">Type Definitions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'jemalloc_sys', ty: 'mod', relpath: '../'};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/jemalloc_sys/lib.rs.html#1-903' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>jemalloc_sys</a></span></h1><div class='docblock'><p>Rust bindings to the <code>jemalloc</code> C library.</p>
|
|||
|
<p><code>jemalloc</code> is a general purpose memory allocation, its documentation
|
|||
|
can be found here:</p>
|
|||
|
<ul>
|
|||
|
<li><a href="http://jemalloc.net/jemalloc.3.html">API documentation</a></li>
|
|||
|
<li><a href="https://github.com/jemalloc/jemalloc/wiki">Wiki</a> (design documents, presentations, profiling, debugging, tuning, ...)</li>
|
|||
|
</ul>
|
|||
|
<p><code>jemalloc</code> exposes both a standard and a non-standard API.</p>
|
|||
|
<h1 id="standard-api" class="section-header"><a href="#standard-api">Standard API</a></h1>
|
|||
|
<p>The standard API includes: the <a href="../jemalloc_sys/fn.malloc.html" title="`malloc`"><code>malloc</code></a>, <a href="../jemalloc_sys/fn.calloc.html" title="`calloc`"><code>calloc</code></a>, <a href="../jemalloc_sys/fn.realloc.html" title="`realloc`"><code>realloc</code></a>, and
|
|||
|
<a href="../jemalloc_sys/fn.free.html" title="`free`"><code>free</code></a>, which conform to to ISO/IEC 9899:1990 (“ISO C90”),
|
|||
|
<a href="../jemalloc_sys/fn.posix_memalign.html" title="`posix_memalign`"><code>posix_memalign</code></a> which conforms to conforms to POSIX.1-2016, and
|
|||
|
<a href="../jemalloc_sys/fn.aligned_alloc.html" title="`aligned_alloc`"><code>aligned_alloc</code></a>.</p>
|
|||
|
<p>Note that these standard leave some details as <em>implementation defined</em>.
|
|||
|
This docs document this behavior for <code>jemalloc</code>, but keep in mind that other
|
|||
|
standard-conforming implementations of these functions in other allocators
|
|||
|
might behave slightly different.</p>
|
|||
|
<h1 id="non-standard-api" class="section-header"><a href="#non-standard-api">Non-Standard API</a></h1>
|
|||
|
<p>The non-standard API includes: <a href="../jemalloc_sys/fn.mallocx.html" title="`mallocx`"><code>mallocx</code></a>, <a href="../jemalloc_sys/fn.rallocx.html" title="`rallocx`"><code>rallocx</code></a>, <a href="../jemalloc_sys/fn.xallocx.html" title="`xallocx`"><code>xallocx</code></a>,
|
|||
|
<a href="../jemalloc_sys/fn.sallocx.html" title="`sallocx`"><code>sallocx</code></a>, <a href="../jemalloc_sys/fn.dallocx.html" title="`dallocx`"><code>dallocx</code></a>, <a href="../jemalloc_sys/fn.sdallocx.html" title="`sdallocx`"><code>sdallocx</code></a>, and <a href="../jemalloc_sys/fn.nallocx.html" title="`nallocx`"><code>nallocx</code></a>. These functions all
|
|||
|
have a <code>flags</code> argument that can be used to specify options. Use bitwise or
|
|||
|
<code>|</code> to specify one or more of the following: <a href="../jemalloc_sys/fn.MALLOCX_LG_ALIGN.html" title="`MALLOCX_LG_ALIGN`"><code>MALLOCX_LG_ALIGN</code></a>,
|
|||
|
<a href="../jemalloc_sys/fn.MALLOCX_ALIGN.html" title="`MALLOCX_ALIGN`"><code>MALLOCX_ALIGN</code></a>, <a href="../jemalloc_sys/constant.MALLOCX_ZERO.html" title="`MALLOCX_ZERO`"><code>MALLOCX_ZERO</code></a>, <a href="../jemalloc_sys/fn.MALLOCX_TCACHE.html" title="`MALLOCX_TCACHE`"><code>MALLOCX_TCACHE</code></a>,
|
|||
|
<a href="../jemalloc_sys/fn.MALLOCX_TCACHE_NONE.html" title="`MALLOCX_TCACHE_NONE`"><code>MALLOCX_TCACHE_NONE</code></a>, and <a href="../jemalloc_sys/fn.MALLOCX_ARENA.html" title="`MALLOCX_ARENA`"><code>MALLOCX_ARENA</code></a>.</p>
|
|||
|
<h1 id="environment-variables" class="section-header"><a href="#environment-variables">Environment variables</a></h1>
|
|||
|
<p>The <code>MALLOC_CONF</code> environment variable affects the execution of the allocation functions.</p>
|
|||
|
<p>For the documentation of the <a href="http://jemalloc.net/jemalloc.3.html#mallctl_namespace"><code>MALLCTL</code> namespace visit the jemalloc
|
|||
|
documenation</a>.</p>
|
|||
|
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
|
|||
|
<table><tr class='module-item'><td><a class="struct" href="struct.extent_hooks_s.html" title='jemalloc_sys::extent_hooks_s struct'>extent_hooks_s</a></td><td class='docblock-short'><p>Extent lifetime management functions.</p>
|
|||
|
</td></tr></table><h2 id='constants' class='section-header'><a href="#constants">Constants</a></h2>
|
|||
|
<table><tr class='module-item'><td><a class="constant" href="constant.MALLOCX_ZERO.html" title='jemalloc_sys::MALLOCX_ZERO constant'>MALLOCX_ZERO</a></td><td class='docblock-short'><p>Initialize newly allocated memory to contain zero bytes.</p>
|
|||
|
</td></tr></table><h2 id='statics' class='section-header'><a href="#statics">Statics</a></h2>
|
|||
|
<table><tr class='module-item'><td><a class="static" href="static.malloc_conf.html" title='jemalloc_sys::malloc_conf static'>malloc_conf</a></td><td class='docblock-short'><p>Compile-time string of configuration options.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="static" href="static.malloc_message.html" title='jemalloc_sys::malloc_message static'>malloc_message</a></td><td class='docblock-short'><p>Allows overriding the function which emits the text strings forming the
|
|||
|
errors and warnings if for some reason the <code>STDERR_FILENO</code> file descriptor
|
|||
|
is not suitable for this.</p>
|
|||
|
</td></tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
|
|||
|
<table><tr class='module-item'><td><a class="fn" href="fn.MALLOCX_ALIGN.html" title='jemalloc_sys::MALLOCX_ALIGN fn'>MALLOCX_ALIGN</a></td><td class='docblock-short'><p>Align the memory allocation to start at an address that is a multiple of <code>align</code>,
|
|||
|
where a is a power of two.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.MALLOCX_ARENA.html" title='jemalloc_sys::MALLOCX_ARENA fn'>MALLOCX_ARENA</a></td><td class='docblock-short'><p>Use the arena specified by the index <code>a</code>.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.MALLOCX_LG_ALIGN.html" title='jemalloc_sys::MALLOCX_LG_ALIGN fn'>MALLOCX_LG_ALIGN</a></td><td class='docblock-short'><p>Align the memory allocation to start at an address that is a
|
|||
|
multiple of <code>1 << la</code>.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.MALLOCX_TCACHE.html" title='jemalloc_sys::MALLOCX_TCACHE fn'>MALLOCX_TCACHE</a></td><td class='docblock-short'><p>Use the thread-specific cache (<em>tcache</em>) specified by the identifier <code>tc</code>.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.MALLOCX_TCACHE_NONE.html" title='jemalloc_sys::MALLOCX_TCACHE_NONE fn'>MALLOCX_TCACHE_NONE</a></td><td class='docblock-short'><p>Do not use a thread-specific cache (<em>tcache</em>).</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.aligned_alloc.html" title='jemalloc_sys::aligned_alloc fn'>aligned_alloc</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Allocates <code>size</code> bytes of memory at an address which is a multiple of
|
|||
|
<code>alignment</code>.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.calloc.html" title='jemalloc_sys::calloc fn'>calloc</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Allocates zero-initialized space for an array of <code>number</code> objects, each
|
|||
|
of whose size is <code>size</code>.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.dallocx.html" title='jemalloc_sys::dallocx fn'>dallocx</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Deallocates previously-allocated memory region referenced by <code>ptr</code>.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.free.html" title='jemalloc_sys::free fn'>free</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Deallocates previously-allocated memory region referenced by <code>ptr</code>.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.mallctl.html" title='jemalloc_sys::mallctl fn'>mallctl</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>General interface for introspecting the memory allocator, as well as
|
|||
|
setting modifiable parameters and triggering actions.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.mallctlbymib.html" title='jemalloc_sys::mallctlbymib fn'>mallctlbymib</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Like <a href="../jemalloc_sys/fn.mallctl.html" title="`mallctl`"><code>mallctl</code></a> but taking a <code>mib</code> as input instead of a name.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.mallctlnametomib.html" title='jemalloc_sys::mallctlnametomib fn'>mallctlnametomib</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Translates a name to a “Management Information Base” (MIB) that can be
|
|||
|
passed repeatedly to <a href="../jemalloc_sys/fn.mallctlbymib.html" title="`mallctlbymib`"><code>mallctlbymib</code></a>.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.malloc.html" title='jemalloc_sys::malloc fn'>malloc</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Allocates <code>size</code> bytes of uninitialized memory.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.malloc_stats_print.html" title='jemalloc_sys::malloc_stats_print fn'>malloc_stats_print</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Writes summary statistics via the <code>write_cb</code> callback function pointer
|
|||
|
and <code>cbopaque</code> data passed to <code>write_cb</code>, or <a href="../jemalloc_sys/static.malloc_message.html" title="`malloc_message`"><code>malloc_message</code></a> if <code>write_cb</code>
|
|||
|
is null.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.malloc_usable_size.html" title='jemalloc_sys::malloc_usable_size fn'>malloc_usable_size</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Returns the real size of the previously-allocated memory region
|
|||
|
referenced by <code>ptr</code>.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.mallocx.html" title='jemalloc_sys::mallocx fn'>mallocx</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Allocates at least <code>size</code> bytes of memory according to <code>flags</code>.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.nallocx.html" title='jemalloc_sys::nallocx fn'>nallocx</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Returns the real size of the allocation that would result from a
|
|||
|
<a href="../jemalloc_sys/fn.mallocx.html" title="`mallocx`"><code>mallocx</code></a> function call with the same arguments.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.posix_memalign.html" title='jemalloc_sys::posix_memalign fn'>posix_memalign</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Allocates <code>size</code> bytes of memory at an address which is a multiple of
|
|||
|
<code>alignment</code> and is placed in <code>*ptr</code>.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.rallocx.html" title='jemalloc_sys::rallocx fn'>rallocx</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Resizes the previously-allocated memory region referenced by <code>ptr</code> to be
|
|||
|
at least <code>size</code> bytes.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.realloc.html" title='jemalloc_sys::realloc fn'>realloc</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Resizes the previously-allocated memory region referenced by <code>ptr</code> to
|
|||
|
<code>size</code> bytes.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.sallocx.html" title='jemalloc_sys::sallocx fn'>sallocx</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Returns the real size of the previously-allocated memory region
|
|||
|
referenced by <code>ptr</code>.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.sdallocx.html" title='jemalloc_sys::sdallocx fn'>sdallocx</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Deallocates previously-allocated memory region referenced by <code>ptr</code> with
|
|||
|
<code>size</code> hint.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.xallocx.html" title='jemalloc_sys::xallocx fn'>xallocx</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td><td class='docblock-short'><p>Resizes the previously-allocated memory region referenced by <code>ptr</code> <em>in
|
|||
|
place</em> to be at least <code>size</code> bytes, returning the real size of the
|
|||
|
allocation.</p>
|
|||
|
</td></tr></table><h2 id='types' class='section-header'><a href="#types">Type Definitions</a></h2>
|
|||
|
<table><tr class='module-item'><td><a class="type" href="type.extent_alloc_t.html" title='jemalloc_sys::extent_alloc_t type'>extent_alloc_t</a></td><td class='docblock-short'><p>Extent allocation function.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="type" href="type.extent_commit_t.html" title='jemalloc_sys::extent_commit_t type'>extent_commit_t</a></td><td class='docblock-short'><p>Extent commit function.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="type" href="type.extent_dalloc_t.html" title='jemalloc_sys::extent_dalloc_t type'>extent_dalloc_t</a></td><td class='docblock-short'><p>Extent deallocation function.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="type" href="type.extent_decommit_t.html" title='jemalloc_sys::extent_decommit_t type'>extent_decommit_t</a></td><td class='docblock-short'><p>Extent decommit function.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="type" href="type.extent_destroy_t.html" title='jemalloc_sys::extent_destroy_t type'>extent_destroy_t</a></td><td class='docblock-short'><p>Extent destruction function.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="type" href="type.extent_hooks_t.html" title='jemalloc_sys::extent_hooks_t type'>extent_hooks_t</a></td><td class='docblock-short'><p>Extent lifetime management functions.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="type" href="type.extent_merge_t.html" title='jemalloc_sys::extent_merge_t type'>extent_merge_t</a></td><td class='docblock-short'><p>Extent merge function.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="type" href="type.extent_purge_t.html" title='jemalloc_sys::extent_purge_t type'>extent_purge_t</a></td><td class='docblock-short'><p>Extent purge function.</p>
|
|||
|
</td></tr><tr class='module-item'><td><a class="type" href="type.extent_split_t.html" title='jemalloc_sys::extent_split_t type'>extent_split_t</a></td><td class='docblock-short'><p>Extent split function.</p>
|
|||
|
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "jemalloc_sys";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|