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]
Parameter Description
Table 1 Parameters
Parameter
|
Description
|
Value Range
|
No parameter
|
Displays the size in the unit of byte.
|
N/A
|
-k
|
Displays the size in the unit of KB.
|
N/A
|
-m
|
Displays the size in the unit of MB.
|
N/A
|
Usage
None
Example
Enter free, free -k, and free -m, respectively.
Output
Figure 1 Displaying the memory usage in three units
![displaying-the-memory-usage-in-three-units](figures/displaying-the-memory-usage-in-three-units.png)
Table 2 Output description
Parameter
|
Description
|
total
|
Indicates the total size of the dynamic memory pool.
|
used
|
Indicates the size of the used memory.
|
free
|
Indicates the size of the unallocated memory.
|
heap
|
Indicates the size of the allocated heap.
|
text
|
Indicates the size of a code segment.
|
data
|
Indicates the size of a data segment.
|
rodata
|
Indicates the size of a read-only data segment.
|
bss
|
Indicates the size of the memory occupied by uninitialized global variables.
|