• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# oom
2
3## Command Function<a name="section366714216619"></a>
4
5This command is used to query and set the low memory threshold and the PageCache reclaim threshold.
6
7## Syntax<a name="section8833164614615"></a>
8
9oom
10
11oom -i \[_interval_\]
12
13oom -m \[_mem byte_\]
14
15oom -r \[_mem byte_\]
16
17oom -h | --help
18
19## Parameters<a name="section12809111019453"></a>
20
21**Table  1**  Parameter description
22
23<a name="table438mcpsimp"></a>
24<table><thead align="left"><tr id="row444mcpsimp"><th class="cellrowborder" valign="top" width="21%" id="mcps1.2.4.1.1"><p id="p446mcpsimp"><a name="p446mcpsimp"></a><a name="p446mcpsimp"></a>Parameter</p>
25</th>
26<th class="cellrowborder" valign="top" width="52%" id="mcps1.2.4.1.2"><p id="p448mcpsimp"><a name="p448mcpsimp"></a><a name="p448mcpsimp"></a>Description</p>
27</th>
28<th class="cellrowborder" valign="top" width="27%" id="mcps1.2.4.1.3"><p id="p450mcpsimp"><a name="p450mcpsimp"></a><a name="p450mcpsimp"></a>Value Range</p>
29</th>
30</tr>
31</thead>
32<tbody><tr id="row451mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p5196112612119"><a name="p5196112612119"></a><a name="p5196112612119"></a>-i [interval]</p>
33</td>
34<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p1149945111817"><a name="p1149945111817"></a><a name="p1149945111817"></a>Sets the interval (in ms) for checking the Out Of Memory (OOM) thread task.</p>
35</td>
36<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p749810571812"><a name="p749810571812"></a><a name="p749810571812"></a>100 to 10000</p>
37</td>
38</tr>
39<tr id="row18583553793"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p95841853292"><a name="p95841853292"></a><a name="p95841853292"></a>-m [mem byte]</p>
40</td>
41<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p2058485315912"><a name="p2058485315912"></a><a name="p2058485315912"></a>Sets the low memory threshold (in MB).</p>
42</td>
43<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p1584105318917"><a name="p1584105318917"></a><a name="p1584105318917"></a>0 (disables the low memory check) to 1</p>
44</td>
45</tr>
46<tr id="row17926124131218"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p49266245128"><a name="p49266245128"></a><a name="p49266245128"></a>-r [mem byte]</p>
47</td>
48<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p159263241121"><a name="p159263241121"></a><a name="p159263241121"></a>Sets the PageCache reclaim threshold.</p>
49</td>
50<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p692642412121"><a name="p692642412121"></a><a name="p692642412121"></a>Ranging from the low memory threshold to the maximum available system memory</p>
51</td>
52</tr>
53<tr id="row1176110379557"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p4762113745519"><a name="p4762113745519"></a><a name="p4762113745519"></a>-h | --help</p>
54</td>
55<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p9762113775517"><a name="p9762113775517"></a><a name="p9762113775517"></a>Displays help information.</p>
56</td>
57<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p7762133765511"><a name="p7762133765511"></a><a name="p7762133765511"></a>N/A</p>
58</td>
59</tr>
60</tbody>
61</table>
62
63## Usage<a name="section15935131220717"></a>
64
65If no parameter is specified, this command displays the current OOM configuration.
66
67>![](../public_sys-resources/icon-note.gif) **NOTE:**
68>If the system memory is insufficient, the system displays a message indicating the insufficiency.
69
70## Example<a name="section387104374416"></a>
71
72Run the following commands:
73
74-   oom
75-   oom -i 100
76
77## Output<a name="section12742311179"></a>
78
79Example 1: displaying OOM configuration
80
81```
82OHOS:/$ oom
83[oom] oom loop task status: enabled
84      oom low memory threshold: 0x80000(byte)
85      oom reclaim memory threshold: 0x500000(byte)
86      oom check interval: 100(microsecond)
87```
88
89Information displayed when the system memory is insufficient:
90
91```
92T:20 Enter:IT MEM 00M 001
93[oom] OS is in low memory state
94total physical memory: 0x1bcf000(byte), used: 0x1b50000(byte) ,free: 0x7f000(byte), low memory threshold: 0x80000(byte)
95[oom] candidate victim process init pid: 1, actual phy mem byte:82602
96[oom] candidate victim process shell pid: 3, actual phy mem byte:14950e
97[oom] candidate victim process testsuits app pid: 4, actual phy mem byte:1334598
98[oom] candidate victim process UserProcess12 pid: 12, actual phy mem byte:25951558
99[oom] max phy mem used process UserProcess12 pid: 12, actual phy mem 25951558
100################excFrom: User!####################
101data abort fsr:0x817, far:0x225af000
102Abort caused by a write instruction. Translation fault, page
103excType: data abort
104processName    = UserProcess12
105processID      = 12
106process aspace = 0х01000000 -> 0х3f000000
107taskName       = threado
108taskID         = 22
109task user stack = 0х20e17000 -> 0х20e21000
110pc   = 0x93969dc in /usr/bin/testsuits app ---> 0x19f9dc
111ulr  = 0x93969cc in /usr/bin/testsuits app ---> 0x19f9cc
112usp  = 0х20e20c68fp = 0x20e20c8c
113R0   = 0х20e35000
114R1   = 0x225af000
115R2   = 0x0
116R3   = 0х28e35000
117R4   = 0х0
118R5   = 0х9500000
119R6   = 0х14
120R7   = 0х97822c4
121R8   = 0x970cfa8
122R9   = 0x9090909
123R10  = 0xa0a0a0a
124R11  = 0x20e20c8c
125R12  = 0х0
126CPSR = 0х80000010
127*******backtrace beain*******
128traceback 0 -- lr = 0x9242e1c fp = 0х20e20cc4 lr in /usr/bin/testsuits apr 0x4be1c
129traceback 1 -- 1r = 0х92430cc fp = 0x20e20cdc lr in /usr/bin/testsuits app --> 0x4c0cc
130traceback 2 -- 1r = 0x9396ab0 fp = 0x20e20cec lr in /usr/bin/testsuits app -> 0х19fab0
131traceback 3 -- lr = 0x9393eb4 fp = 0x20e20cf4 lr in /usr/bin/testsuits ap --> 0x19ceb4
132traceback 4 -- lr = 0x92427d4 fp = 0x20e20d44 lr in /usr/bin/testsuits app --> 0x4b7d4
133traceback 5 -- 1r = 0x20c4df50 fp = 0хb0b0b0b 1r in /1ib/libc.so - -> 0x62f50
134```
135
136Example 2: setting the OOM check interval to 100 ms
137
138```
139OHOS:/$ oom -i 100
140[oom] set oom check interval (100)ms successful
141```
142
143**Table  2**  Output
144
145<a name="table487mcpsimp"></a>
146<table><thead align="left"><tr id="row492mcpsimp"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p494mcpsimp"><a name="p494mcpsimp"></a><a name="p494mcpsimp"></a>Output</p>
147</th>
148<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p496mcpsimp"><a name="p496mcpsimp"></a><a name="p496mcpsimp"></a>Description</p>
149</th>
150</tr>
151</thead>
152<tbody><tr id="row502mcpsimp"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p583513382179"><a name="p583513382179"></a><a name="p583513382179"></a>[oom] OS is in low memory state</p>
153<p id="p636114453553"><a name="p636114453553"></a><a name="p636114453553"></a>total physical memory: 0x1bcf000(byte), used: 0x1b50000(byte), free: 0x7f000(byte), low memory threshold: 0x80000(byte)</p>
154</td>
155<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p19833143819174"><a name="p19833143819174"></a><a name="p19833143819174"></a>The operating system has low memory.</p>
156<p id="p83883291587"><a name="p83883291587"></a><a name="p83883291587"></a>The available physical memory in the operating system is <strong id="b15343050123397"><a name="b15343050123397"></a><a name="b15343050123397"></a>0x1bcf000</strong> bytes, <strong id="b18697901323397"><a name="b18697901323397"></a><a name="b18697901323397"></a>0x1b50000</strong> bytes have been used, and <strong id="b3252944373397"><a name="b3252944373397"></a><a name="b3252944373397"></a>0x7f000</strong> bytes are available. The current low memory threshold is <strong id="b13811086363397"><a name="b13811086363397"></a><a name="b13811086363397"></a>0x80000</strong> bytes.</p>
157</td>
158</tr>
159<tr id="row1990234224612"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p3902144294612"><a name="p3902144294612"></a><a name="p3902144294612"></a>[oom] candidate victim process init pid: 1, actual phy mem byte: 82602</p>
160</td>
161<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p13903144284610"><a name="p13903144284610"></a><a name="p13903144284610"></a>Memory usage of each process. The physical memory occupied by the <strong id="b143686319910"><a name="b143686319910"></a><a name="b143686319910"></a>init</strong> process is 82602 bytes.</p>
162</td>
163</tr>
164<tr id="row520212272335"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p172038278339"><a name="p172038278339"></a><a name="p172038278339"></a>[oom] candidate victim process UserProcess12 pid: 12, actual phy mem byte: 25951558</p>
165</td>
166<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p112034276331"><a name="p112034276331"></a><a name="p112034276331"></a>The actual memory used by the <strong id="b16405477923397"><a name="b16405477923397"></a><a name="b16405477923397"></a>UserProcess12</strong> process is <strong id="b10952024983397"><a name="b10952024983397"></a><a name="b10952024983397"></a>25951558</strong> bytes.</p>
167</td>
168</tr>
169<tr id="row3273195033416"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p184989213512"><a name="p184989213512"></a><a name="p184989213512"></a>[oom] max phy mem used process UserProcess12 pid: 12, actual phy mem: 25951558</p>
170</td>
171<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p112741750143417"><a name="p112741750143417"></a><a name="p112741750143417"></a>The process that uses the most memory currently is <strong id="b17770979863397"><a name="b17770979863397"></a><a name="b17770979863397"></a>UserProcess12</strong>.</p>
172</td>
173</tr>
174<tr id="row16442089365"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p045148153618"><a name="p045148153618"></a><a name="p045148153618"></a>excFrom: User!</p>
175</td>
176<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p6452818367"><a name="p6452818367"></a><a name="p6452818367"></a>The system memory is low, and the <strong id="b4088490143397"><a name="b4088490143397"></a><a name="b4088490143397"></a>UserProcess12</strong> process fails to apply for memory and exits.</p>
177</td>
178</tr>
179</tbody>
180</table>
181
182