/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Administration/Linux/system/memory/Malloc-Tunable-Parameters.html

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html lang="en"><head><title>Malloc Tunable Parameters - The GNU C Library</title>
 
2
 
 
3
 
 
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>
 
24
<div class="node">
 
25
<p>
 
26
<a name="Malloc-Tunable-Parameters"></a>
 
27
Next:&nbsp;<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:&nbsp;<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:&nbsp;<a rel="up" accesskey="u" href="http://www.gnu.org/software/libc/manual/html_node/Unconstrained-Allocation.html#Unconstrained-Allocation">Unconstrained Allocation</a>
 
30
</p><hr>
 
31
</div>
 
32
 
 
33
<h5 class="subsubsection">3.2.2.8 Malloc Tunable Parameters</h5>
 
34
 
 
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>
 
39
 
 
40
</p><div class="defun">
 
41
&#8212; 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:
 
45
 
 
46
          </p><dl>
 
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
 
58
<code>free</code>. 
 
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>. 
 
61
</dd></dl>
 
62
 
 
63
        </blockquote></div>
 
64
 
 
65
   
 
66
</body></html>
 
 
b'\\ No newline at end of file'