1
<html lang="en"><head><title>Malloc Tunable Parameters - The GNU C Library</title>
4
<meta http-equiv="Content-Type" content="text/html">
5
<meta name="description" content="The GNU C Library">
6
<meta name="generator" content="makeinfo 4.8">
7
<link title="Top" rel="start" href="http://www.gnu.org/software/libc/manual/html_node/index.html#Top">
8
<link rel="up" href="http://www.gnu.org/software/libc/manual/html_node/Unconstrained-Allocation.html#Unconstrained-Allocation" title="Unconstrained Allocation">
9
<link rel="prev" href="http://www.gnu.org/software/libc/manual/html_node/Aligned-Memory-Blocks.html#Aligned-Memory-Blocks" title="Aligned Memory Blocks">
10
<link rel="next" href="http://www.gnu.org/software/libc/manual/html_node/Heap-Consistency-Checking.html#Heap-Consistency-Checking" title="Heap Consistency Checking">
11
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12
<meta http-equiv="Content-Style-Type" content="text/css">
13
<style type="text/css"><!--
14
pre.display { font-family:inherit }
15
pre.format { font-family:inherit }
16
pre.smalldisplay { font-family:inherit; font-size:smaller }
17
pre.smallformat { font-family:inherit; font-size:smaller }
18
pre.smallexample { font-size:smaller }
19
pre.smalllisp { font-size:smaller }
20
span.sc { font-variant:small-caps }
21
span.roman { font-family:serif; font-weight:normal; }
22
span.sansserif { font-family:sans-serif; font-weight:normal; }
23
--></style></head><body>
26
<a name="Malloc-Tunable-Parameters"></a>
27
Next: <a rel="next" accesskey="n" href="http://www.gnu.org/software/libc/manual/html_node/Heap-Consistency-Checking.html#Heap-Consistency-Checking">Heap Consistency Checking</a>,
28
Previous: <a rel="previous" accesskey="p" href="http://www.gnu.org/software/libc/manual/html_node/Aligned-Memory-Blocks.html#Aligned-Memory-Blocks">Aligned Memory Blocks</a>,
29
Up: <a rel="up" accesskey="u" href="http://www.gnu.org/software/libc/manual/html_node/Unconstrained-Allocation.html#Unconstrained-Allocation">Unconstrained Allocation</a>
33
<h5 class="subsubsection">3.2.2.8 Malloc Tunable Parameters</h5>
35
<p>You can adjust some parameters for dynamic memory allocation with the
36
<code>mallopt</code> function. This function is the general SVID/XPG
37
interface, defined in <samp><span class="file">malloc.h</span></samp>.
38
<a name="index-malloc_002eh-269"></a>
40
</p><div class="defun">
41
— Function: int <b>mallopt</b> (<var>int param, int value</var>)<var><a name="index-mallopt-270"></a></var><br>
42
<blockquote><p>When calling <code>mallopt</code>, the <var>param</var> argument specifies the
43
parameter to be set, and <var>value</var> the new value to be set. Possible
44
choices for <var>param</var>, as defined in <samp><span class="file">malloc.h</span></samp>, are:
47
<dt><code>M_TRIM_THRESHOLD</code></dt><dd>This is the minimum size (in bytes) of the top-most, releasable chunk
48
that will cause <code>sbrk</code> to be called with a negative argument in
49
order to return memory to the system.
50
<br></dd><dt><code>M_TOP_PAD</code></dt><dd>This parameter determines the amount of extra memory to obtain from the
51
system when a call to <code>sbrk</code> is required. It also specifies the
52
number of bytes to retain when shrinking the heap by calling <code>sbrk</code>
53
with a negative argument. This provides the necessary hysteresis in
54
heap size such that excessive amounts of system calls can be avoided.
55
<br></dd><dt><code>M_MMAP_THRESHOLD</code></dt><dd>All chunks larger than this value are allocated outside the normal
56
heap, using the <code>mmap</code> system call. This way it is guaranteed
57
that the memory for these chunks can be returned to the system on
59
<br></dd><dt><code>M_MMAP_MAX</code></dt><dd>The maximum number of chunks to allocate with <code>mmap</code>. Setting this
60
to zero disables all use of <code>mmap</code>.
b'\\ No newline at end of file'