free

Command Function

This command is used to display the memory usage in the system.

Syntax

free [-b | -k | -m | -g | -t]

Parameters

Table 1 Parameter description

Parameter

Description

Value Range

No parameter

Displays the memory usage in bytes.

N/A

--help/-h

Displays the parameters supported by the free command.

N/A

-b

Displays the memory usage in bytes.

N/A

-k

Displays the memory usage in KiB.

N/A

-m

Displays the memory usage in MiB.

N/A

-g

Displays the memory usage in GiB.

N/A

-t

Displays the memory usage in TiB.

N/A

Usage

None

Example

Run free, free -k, and free -m, respectively.

Output

OHOS:/$ free
                total        used        free      shared     buffers
Mem:          2819652     2754468       65184           0           0
-/+ buffers/cache:        2754468       65184
Swap:               0           0           0
OHOS:/$ free -k
                total        used        free      shared     buffers
Mem:             2753        2692          60           0           0
-/+ buffers/cache:           2692          60
Swap:               0           0           0
OHOS:/$ free -m
                total        used        free      shared     buffers
Mem:                2           2           0           0           0
-/+ buffers/cache:              2           0
Swap:               0           0           0

Table 2 Output

Parameter

Description

total

Total size of the dynamic memory pool

used

Size of the used memory

free

Size of the unallocated memory

shared

Size of the shared memory

buffers

Size of the buffer