OSDN Git Service

Retire LDP man-pages repository
[linuxjm/LDP_man-pages.git] / draft / man3 / mallinfo.3
diff --git a/draft/man3/mallinfo.3 b/draft/man3/mallinfo.3
deleted file mode 100644 (file)
index bd059da..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-.\" t
-.\" Copyright (c) 2012 by Michael Kerrisk <mtk.manpages@gmail.com>
-.\"
-.\" %%%LICENSE_START(VERBATIM)
-.\" Permission is granted to make and distribute verbatim copies of this
-.\" manual provided the copyright notice and this permission notice are
-.\" preserved on all copies.
-.\"
-.\" Permission is granted to copy and distribute modified versions of this
-.\" manual under the conditions for verbatim copying, provided that the
-.\" entire resulting derived work is distributed under the terms of a
-.\" permission notice identical to this one.
-.\"
-.\" Since the Linux kernel and libraries are constantly changing, this
-.\" manual page may be incorrect or out-of-date.  The author(s) assume no
-.\" responsibility for errors or omissions, or for damages resulting from
-.\" the use of the information contained herein.  The author(s) may not
-.\" have taken the same level of care in the production of this manual,
-.\" which is licensed free of charge, as they might when working
-.\" professionally.
-.\"
-.\" Formatted or processed versions of this manual, if unaccompanied by
-.\" the source, must acknowledge the copyright and authors of this work.
-.\" %%%LICENSE_END
-.\"
-.\"*******************************************************************
-.\"
-.\" This file was generated with po4a. Translate the source file.
-.\"
-.\"*******************************************************************
-.TH MALLINFO 3 2012\-05\-06 Linux "Linux Programmer's Manual"
-.SH 名前
-mallinfo \- メモリー割り当て情報を取得する
-.SH 書式
-\fB#include <malloc.h>\fP
-
-\fBstruct mallinfo mallinfo(void);\fP
-.SH 説明
-\fBmallinfo\fP() 関数は、 \fBmalloc\fP(3) や一連の関数により実行されたメモリー
-割り当てに関する情報を格納した構造体のコピーを返す。
-この構造体は以下のように定義されている。
-.PP
-.in +4n
-.nf
-struct mallinfo {
-    int arena;     /* Non\-mmapped space allocated (bytes) */
-    int ordblks;   /* Number of free chunks */
-    int smblks;    /* Number of free fastbin blocks */
-    int hblks;     /* Number of mmapped regions */
-    int hblkhd;    /* Space allocated in mmapped regions (bytes) */
-    int usmblks;   /* Maximum total allocated space (bytes) */
-    int fsmblks;   /* Space in freed fastbin blocks (bytes) */
-    int uordblks;  /* Total allocated space (bytes) */
-    int fordblks;  /* Total free space (bytes) */
-    int keepcost;  /* Top\-most, releasable space (bytes) */
-};
-.fi
-.in
-.PP
-\fImallinfo\fP 構造体の各フィールドには以下の情報が格納される。
-.TP  10
-\fIarena\fP
-\fBmmap\fP(2) 以外の手段で割り当てられた総メモリー量 (例えばヒープに割り当てられたメモリー) 。
-この数字には使用中のブロックやフリーリスト上のブロックも含まれる。
-.TP 
-\fIordblks\fP
-通常の (つまり fastbin ではない) 未使用ブロック数。
-.TP 
-\fIsmblks\fP
-fastbin 未使用ブロック数 (\fBmallopt\fP(3) 参照)。
-.TP 
-\fIhblks\fP
-\fBmmap\fP(2) を使って現在割り当てられているブロック数 (\fBmallopt\fP(3) の \fBM_MMAP_THRESHOLD\fP
-の議論を参照)。
-.TP 
-\fIhblkhd\fP
-\fBmmap\fP(2) を使って現在割り当てられているブロックのバイト数。
-.TP 
-\fIusmblks\fP
-割り当てた空間の最高点 ("highwater mark")、 つまり、 これまでの中での最大の割り当て量。
-このフィールドはスレッド化されていない環境でのみ収集される。
-.TP 
-\fIfsmblks\fP
-fastbin フリーブロックの総バイト数。
-.TP 
-\fIuordblks\fP
-使用中の割り当てメモリーで使われているバイト数。
-.TP 
-\fIfordblks\fP
-フリーブロックの総バイト数。
-.TP 
-\fIkeepcost\fP
-.\" .SH VERSIONS
-.\" Available already in glibc 2.0, possibly earlier
-ヒープの一番上にある解放可能な未使用の空間の大きさ。 この値は \fBmalloc_trim\fP(3) で理想的な場合に解放できる最大のバイト数である
-(理想的というのは、 ページ境界の制限などを無視した場合である。
-.SH 準拠
-この関数は POSIX や C 標準では規定されていない。 多くの System V 由来のシステムに同様の関数が存在し、 SVID
-では同様の関数が規定されていた。
-.SH バグ
-.\" FIXME . http://sourceware.org/bugzilla/show_bug.cgi?id=208
-.\" See the 24 Aug 2011 mail by Paul Pluzhnikov:
-.\"     "[patch] Fix mallinfo() to accumulate results for all arenas"
-.\" on libc-alpha@sourceware.org
-\fBこれらの情報はメインのメモリー割り当て領域に対するもののみである。\fP 他の領域の割り当ては対象にならない。
-他の領域の情報も取得できる別の手段については \fBmalloc_stats\fP(3) や \fBmalloc_info\fP(3) を参照。
-
-\fImallinfo\fP 構造体の各フィールドは \fIint\fP 型である。 しかし、 いくつかの内部管理用の値は \fIlong\fP 型の場合もあるので、
-報告される値が一周してしまい、 不正確になる可能性がある。
-.SH 例
-以下のプログラムは \fBmallinfo\fP() を利用して、 メモリーブロックの割り当て、解放のそれぞれ前後でメモリー割り当ての統計情報を取得する。
-統計情報は標準出力に表示される。
-
-最初の 2 つのコマンドライン引き数は \fBmalloc\fP(3) で割り当てるブロック数とサイズを指定する。
-
-残りの 3 つの引き数は、どの割り当てられたブロックを \fBfree\fP(3) で解放すべきかを指定する。 これらの 3 つの引き数の指定は任意で、
-最初のものから順に以下の情報を指定する。 1 つ目の引き数は、 ブロックを解放するループで使用するステップサイズを指定する (デフォルト値は 1 で、
-1 は指定した範囲のすべてのブロックを解放することを意味する)。 2 つ目の引き数は、 解放する先頭ブロックの場所番号を指定する (デフォルト値は 0
-で、 0 は先頭の割り当て済みブロックを意味する)。 3 つ目の引き数は、 解放する最終ブロックの場所番号よりひとつ大きい値を指定する
-(デフォルト値は最大ブロック番号よりもひとつ大きい値である)。 これらの 3 つの引き数が省略された場合、
-デフォルトではすべての割り当てられたブロックが解放される。
-
-以下のプログラムの実行例では、 100 バイトの割り当てを 1000 回実行し、 割り当てたブロックの 2 つに 1 つを解放する。
-.PP
-.in +4n
-.nf
-$ \fB./a.out 1000 100 2\fP
-============== Before allocating blocks ==============
-Total non\-mmapped bytes (arena):       0
-# of free chunks (ordblks):            1
-# of free fastbin blocks (smblks):     0
-# of mapped regions (hblks):           0
-Bytes in mapped regions (hblkhd):      0
-Max. total allocated space (usmblks):  0
-Free bytes held in fastbins (fsmblks): 0
-Total allocated space (uordblks):      0
-Total free space (fordblks):           0
-Topmost releasable block (keepcost):   0
-
-============== After allocating blocks ==============
-Total non\-mmapped bytes (arena):       135168
-# of free chunks (ordblks):            1
-# of free fastbin blocks (smblks):     0
-# of mapped regions (hblks):           0
-Bytes in mapped regions (hblkhd):      0
-Max. total allocated space (usmblks):  0
-Free bytes held in fastbins (fsmblks): 0
-Total allocated space (uordblks):      104000
-Total free space (fordblks):           31168
-Topmost releasable block (keepcost):   31168
-
-============== After freeing blocks ==============
-Total non\-mmapped bytes (arena):       135168
-# of free chunks (ordblks):            501
-# of free fastbin blocks (smblks):     0
-# of mapped regions (hblks):           0
-Bytes in mapped regions (hblkhd):      0
-Max. total allocated space (usmblks):  0
-Free bytes held in fastbins (fsmblks): 0
-Total allocated space (uordblks):      52000
-Total free space (fordblks):           83168
-Topmost releasable block (keepcost):   31168
-.fi
-.in
-.SS プログラムのソース
-\&
-.nf
-#include <malloc.h>
-#include "tlpi_hdr.h"
-
-static void
-display_mallinfo(void)
-{
-    struct mallinfo mi;
-
-    mi = mallinfo();
-
-    printf("Total non\-mmapped bytes (arena):       %d\en", mi.arena);
-    printf("# of free chunks (ordblks):            %d\en", mi.ordblks);
-    printf("# of free fastbin blocks (smblks):     %d\en", mi.smblks);
-    printf("# of mapped regions (hblks):           %d\en", mi.hblks);
-    printf("Bytes in mapped regions (hblkhd):      %d\en", mi.hblkhd);
-    printf("Max. total allocated space (usmblks):  %d\en", mi.usmblks);
-    printf("Free bytes held in fastbins (fsmblks): %d\en", mi.fsmblks);
-    printf("Total allocated space (uordblks):      %d\en", mi.uordblks);
-    printf("Total free space (fordblks):           %d\en", mi.fordblks);
-    printf("Topmost releasable block (keepcost):   %d\en", mi.keepcost);
-}
-
-int
-main(int argc, char *argv[])
-{
-#define MAX_ALLOCS 2000000
-    char *alloc[MAX_ALLOCS];
-    int numBlocks, j, freeBegin, freeEnd, freeStep;
-    size_t blockSize;
-
-    if (argc < 3 || strcmp(argv[1], "\-\-help") == 0)
-        usageErr("%s num\-blocks block\-size [free\-step [start\-free "
-                "[end\-free]]]\en", argv[0]);
-
-    numBlocks = atoi(argv[1]);
-    blockSize = atoi(argv[2]);
-    freeStep = (argc > 3) ? atoi(argv[3]) : 1;
-    freeBegin = (argc > 4) ? atoi(argv[4]) : 0;
-    freeEnd = (argc > 5) ? atoi(argv[5]) : numBlocks;
-
-    printf("============== Before allocating blocks ==============\en");
-    display_mallinfo();
-
-    for (j = 0; j < numBlocks; j++) {
-        if (numBlocks >= MAX_ALLOCS)
-            fatal("Too many allocations");
-
-        alloc[j] = malloc(blockSize);
-        if (alloc[j] == NULL)
-            errExit("malloc");
-    }
-
-    printf("\en============== After allocating blocks ==============\en");
-    display_mallinfo();
-
-    for (j = freeBegin; j < freeEnd; j += freeStep)
-        free(alloc[j]);
-
-    printf("\en============== After freeing blocks ==============\en");
-    display_mallinfo();
-
-    exit(EXIT_SUCCESS);
-}
-.fi
-.SH 関連項目
-.ad l
-.nh
-\fBmmap\fP(2), \fBmalloc\fP(3), \fBmalloc_info\fP(3), \fBmalloc_stats\fP(3),
-\fBmalloc_trim\fP(3), \fBmallopt\fP(3)
-.SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
-である。プロジェクトの説明とバグ報告に関する情報は
-http://www.kernel.org/doc/man\-pages/ に書かれている。