.\" Copyright (c) 2012 by Michael Kerrisk .\" .\" %%%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 MALLOC_TRIM 3 2020\-08\-13 Linux "Linux Programmer's Manual" .SH 名前 malloc_trim \- ヒープから未使用メモリーを解放する .SH 書式 \fB#include \fP .PP \fBint malloc_trim(size_t \fP\fIpad\fP\fB);\fP .SH 説明 \fBmalloc_trim\fP() 関数は (適切な引数で \fBsbrk\fP(2) や \fBmadvise\fP(2) を呼び出して) ヒープの未使用メモリーの解放を試みる。 .PP \fIpad\fP 引数は、 ヒープの一番上から切り詰める際に残す未使用領域の量を指定する。 この引数が 0 の場合、 ヒープの一番上の最小量のメモリーだけを維持できる (つまり 1 ページかそれ未満)。 0 以外の引数を指定すると、 ヒープの一番上にある程度の量の未使用領域を残し、 将来の割り当てを \fBsbrk\fP(2) でヒープを拡張せずに行えるようにできる。 .SH 返り値 \fBmalloc_trim\fP() 関数はメモリーが実際に解放されシステムに戻された場合に 1 を返し、 どのメモリーも解放できなかった場合は 0 を返す。 .SH エラー .\" .SH VERSIONS .\" Available already in glibc 2.0, possibly earlier エラーは定義されていない。 .SH 属性 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。 .TS allbox; lb lb lb l l l. インターフェース 属性 値 T{ \fBmalloc_trim\fP() T} Thread safety MT\-Safe .TE .sp 1 .SH 準拠 この関数は GNU による拡張である。 .SH 注意 この関数は、 特定の状況では \fBfree\fP(3) により自動的に呼び出される。 \fBmallopt\fP(3) の \fBM_TOP_PAD\fP と \fBM_TRIM_THRESHOLD\fP の議論を参照。 .PP Only the main heap (using \fBsbrk\fP(2)) honors the \fIpad\fP argument; thread heaps do not. .PP .\" See commit 68631c8eb92ff38d9da1ae34f6aa048539b199cc .\" (dated 2007-12-16) which adds iteration over all .\" arenas and frees all pages in chunks which are free. Since glibc 2.8 this function frees memory in all arenas and in all chunks with whole free pages. .PP Before glibc 2.8 this function only freed memory at the top of the heap in the main arena. .SH 関連項目 \fBsbrk\fP(2), \fBmalloc\fP(3), \fBmallopt\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。