.\" This page Copyright (C) 1993 Matt Welsh, mdw@sunsite.unc.edu.
.\" Long options where added at April 15th, 2011.
.\" Freely distributable under the terms of the GPL
-.TH FREE 1 "2018-05-31" "procps-ng" "User Commands"
+.TH FREE 1 "2020-06-16" "procps-ng" "User Commands"
.SH NAME
free \- Display amount of free and used memory in the system
.SH SYNOPSIS
\fB\-t\fR, \fB\-\-total\fR
Display a line showing the column totals.
.TP
+\fB\-v\fR, \fB\-\-committed\fR
+Display a line showing the memory commit limit and amount of committed/uncommitted
+memory. The \fBtotal\fR column on this line will display the memory commit
+limit. This line is relevant if memory overcommit is disabled.
+.TP
\fB\-\-help\fR
Print help.
.TP
#define FREE_SI (1 << 5)
#define FREE_REPEAT (1 << 6)
#define FREE_REPEATCOUNT (1 << 7)
+#define FREE_COMMITTED (1 << 8)
struct commandline_arguments {
int exponent; /* demanded in kilos, magas... */
fputs(_(" --si use powers of 1000 not 1024\n"), out);
fputs(_(" -l, --lohi show detailed low and high memory statistics\n"), out);
fputs(_(" -t, --total show total for RAM + swap\n"), out);
+ fputs(_(" -v, --committed show committed memory and commit limit\n"), out);
fputs(_(" -s N, --seconds N repeat printing every N seconds\n"), out);
fputs(_(" -c N, --count N repeat printing N times, then exit\n"), out);
fputs(_(" -w, --wide wide output\n"), out);
{ "si", no_argument, NULL, SI_OPTION },
{ "lohi", no_argument, NULL, 'l' },
{ "total", no_argument, NULL, 't' },
+ { "committed", no_argument, NULL, 'v' },
{ "seconds", required_argument, NULL, 's' },
{ "count", required_argument, NULL, 'c' },
{ "wide", no_argument, NULL, 'w' },
textdomain(PACKAGE);
atexit(close_stdout);
- while ((c = getopt_long(argc, argv, "bkmghltc:ws:V", longopts, NULL)) != -1)
+ while ((c = getopt_long(argc, argv, "bkmghltvc:ws:V", longopts, NULL)) != -1)
switch (c) {
case 'b':
check_unit_set(&unit_set);
case 't':
flags |= FREE_TOTAL;
break;
+ case 'v':
+ flags |= FREE_COMMITTED;
+ break;
case 's':
flags |= FREE_REPEAT;
errno = 0;
MEMINFO_GET(mem_info, MEMINFO_SWAP_FREE, ul_int), flags, args));
printf("\n");
}
+ if (flags & FREE_COMMITTED) {
+ printf("%-9s", _("Comm:"));
+ printf("%11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEM_COMMIT_LIMIT, ul_int), flags, args));
+ printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEM_COMMITTED_AS, ul_int), flags, args));
+ printf(" %11s", scale_size(
+ MEMINFO_GET(mem_info, MEMINFO_MEM_COMMIT_LIMIT, ul_int) -
+ MEMINFO_GET(mem_info, MEMINFO_MEM_COMMITTED_AS, ul_int), flags, args));
+ printf("\n");
+ }
+
fflush(stdout);
if (flags & FREE_REPEATCOUNT) {
args.repeat_counter--;