Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

130 rindas
5.7KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>mallinfo (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="mallinfo (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="mallinfo (The Red Hat newlib C Library)">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <link href="index.html#Top" rel="start" title="Top">
  13. <link href="Document-Index.html#Document-Index" rel="index" title="Document Index">
  14. <link href="Document-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
  15. <link href="Stdlib.html#Stdlib" rel="up" title="Stdlib">
  16. <link href="_005f_005fmalloc_005flock.html#g_t_005f_005fmalloc_005flock" rel="next" title="__malloc_lock">
  17. <link href="malloc.html#malloc" rel="prev" title="malloc">
  18. <style type="text/css">
  19. <!--
  20. a.summary-letter {text-decoration: none}
  21. blockquote.indentedblock {margin-right: 0em}
  22. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  23. blockquote.smallquotation {font-size: smaller}
  24. div.display {margin-left: 3.2em}
  25. div.example {margin-left: 3.2em}
  26. div.lisp {margin-left: 3.2em}
  27. div.smalldisplay {margin-left: 3.2em}
  28. div.smallexample {margin-left: 3.2em}
  29. div.smalllisp {margin-left: 3.2em}
  30. kbd {font-style: oblique}
  31. pre.display {font-family: inherit}
  32. pre.format {font-family: inherit}
  33. pre.menu-comment {font-family: serif}
  34. pre.menu-preformatted {font-family: serif}
  35. pre.smalldisplay {font-family: inherit; font-size: smaller}
  36. pre.smallexample {font-size: smaller}
  37. pre.smallformat {font-family: inherit; font-size: smaller}
  38. pre.smalllisp {font-size: smaller}
  39. span.nolinebreak {white-space: nowrap}
  40. span.roman {font-family: initial; font-weight: normal}
  41. span.sansserif {font-family: sans-serif; font-weight: normal}
  42. ul.no-bullet {list-style: none}
  43. -->
  44. </style>
  45. </head>
  46. <body lang="en">
  47. <a name="mallinfo"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="_005f_005fmalloc_005flock.html#g_t_005f_005fmalloc_005flock" accesskey="n" rel="next">__malloc_lock</a>, Previous: <a href="malloc.html#malloc" accesskey="p" rel="prev">malloc</a>, Up: <a href="Stdlib.html#Stdlib" accesskey="u" rel="up">Stdlib</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  51. </div>
  52. <hr>
  53. <a name="mallinfo_002c-malloc_005fstats_002c-mallopt_002d_002d_002dmalloc-support"></a>
  54. <h3 class="section">2.25 <code>mallinfo</code>, <code>malloc_stats</code>, <code>mallopt</code>&mdash;malloc support</h3>
  55. <a name="index-mallinfo"></a>
  56. <a name="index-malloc_005fstats"></a>
  57. <a name="index-mallopt"></a>
  58. <a name="index-_005fmallinfo_005fr"></a>
  59. <a name="index-_005fmalloc_005fstats_005fr"></a>
  60. <a name="index-_005fmallopt_005fr"></a>
  61. <p><strong>Synopsis</strong>
  62. </p><div class="example">
  63. <pre class="example">#include &lt;malloc.h&gt;
  64. struct mallinfo mallinfo(void);
  65. void malloc_stats(void);
  66. int mallopt(int <var>parameter</var>, <var>value</var>);
  67. struct mallinfo _mallinfo_r(void *<var>reent</var>);
  68. void _malloc_stats_r(void *<var>reent</var>);
  69. int _mallopt_r(void *<var>reent</var>, int <var>parameter</var>, <var>value</var>);
  70. </pre></div>
  71. <p><strong>Description</strong><br>
  72. <code>mallinfo</code> returns a structure describing the current state of
  73. memory allocation. The structure is defined in malloc.h. The
  74. following fields are defined: <code>arena</code> is the total amount of space
  75. in the heap; <code>ordblks</code> is the number of chunks which are not in use;
  76. <code>uordblks</code> is the total amount of space allocated by <code>malloc</code>;
  77. <code>fordblks</code> is the total amount of space not in use; <code>keepcost</code> is
  78. the size of the top most memory block.
  79. </p>
  80. <p><code>malloc_stats</code> print some statistics about memory allocation on
  81. standard error.
  82. </p>
  83. <p><code>mallopt</code> takes a parameter and a value. The parameters are defined
  84. in malloc.h, and may be one of the following: <code>M_TRIM_THRESHOLD</code>
  85. sets the maximum amount of unused space in the top most block before
  86. releasing it back to the system in <code>free</code> (the space is released by
  87. calling <code>_sbrk_r</code> with a negative argument); <code>M_TOP_PAD</code> is the
  88. amount of padding to allocate whenever <code>_sbrk_r</code> is called to
  89. allocate more space.
  90. </p>
  91. <p>The alternate functions <code>_mallinfo_r</code>, <code>_malloc_stats_r</code>, and
  92. <code>_mallopt_r</code> are reentrant versions. The extra argument <var>reent</var>
  93. is a pointer to a reentrancy structure.
  94. </p>
  95. <br>
  96. <p><strong>Returns</strong><br>
  97. <code>mallinfo</code> returns a mallinfo structure. The structure is defined
  98. in malloc.h.
  99. </p>
  100. <p><code>malloc_stats</code> does not return a result.
  101. </p>
  102. <p><code>mallopt</code> returns zero if the parameter could not be set, or
  103. non-zero if it could be set.
  104. </p>
  105. <br>
  106. <p><strong>Portability</strong><br>
  107. <code>mallinfo</code> and <code>mallopt</code> are provided by SVR4, but <code>mallopt</code>
  108. takes different parameters on different systems. <code>malloc_stats</code> is
  109. not portable.
  110. </p>
  111. <br>
  112. <hr>
  113. <div class="header">
  114. <p>
  115. Next: <a href="_005f_005fmalloc_005flock.html#g_t_005f_005fmalloc_005flock" accesskey="n" rel="next">__malloc_lock</a>, Previous: <a href="malloc.html#malloc" accesskey="p" rel="prev">malloc</a>, Up: <a href="Stdlib.html#Stdlib" accesskey="u" rel="up">Stdlib</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  116. </div>
  117. </body>
  118. </html>