free

Command Function

This command is used to display the system memory usage and the sizes of the text, data, rodata, and bss segments.

Syntax

free [-k | -m]

Parameters

Table 1 Parameter description

Parameter

Description

Value Range

No parameter

Displays the size in bytes.

N/A

-k

Displays the size in KiB.

N/A

-m

Displays the size in MiB.

N/A

Usage

None

Example

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

Output

Figure 1 Displaying the memory usage in three units

Table 2 Output

Output

Description

total

Total size of the dynamic memory pool

used

Size of the used memory

free

Size of the unallocated memory

heap

Size of the allocated heap

text

Size of a code segment

data

Size of a data segment

rodata

Size of a read-only data segment

bss

Size of the memory occupied by uninitialized global variables