最終更新:2025-01-04 (土) 03:52:29 (186d)  

free
Top / free

メモリ領域を解放する

void free(void *ptr);

メモ

  • mallocが返したポインターを与える
  • 不要になったメモリを、再利用のために「空きメモリリスト」に付け加えている

Linux/コマンド

  • free -m : 表示結果をメガバイト単位で表示します。

help

  • Usage:
     free [options]
    
    Options:
     -b, --bytes         show output in bytes
         --kilo          show output in kilobytes
         --mega          show output in megabytes
         --giga          show output in gigabytes
         --tera          show output in terabytes
         --peta          show output in petabytes
     -k, --kibi          show output in kibibytes
     -m, --mebi          show output in mebibytes
     -g, --gibi          show output in gibibytes
         --tebi          show output in tebibytes
         --pebi          show output in pebibytes
     -h, --human         show human-readable output
         --si            use powers of 1000 not 1024
     -l, --lohi          show detailed low and high memory statistics
     -t, --total         show total for RAM + swap
     -s N, --seconds N   repeat printing every N seconds
     -c N, --count N     repeat printing N times, then exit
     -w, --wide          wide output
    
         --help     display this help and exit
     -V, --version  output version information and exit
    
    For more details see free(1).