1# oom 2 3 4## Command Function 5 6This command is used to query and set the low memory threshold and the PageCache reclaim threshold. 7 8 9## Syntax 10 11oom 12 13oom -i [_interval_] 14 15oom -m [_mem byte_] 16 17oom -r [_mem byte_] 18 19oom -h | --help 20 21 22## Parameters 23 24**Table 1** Parameter description 25 26| Parameter | Description | Value Range | 27| ----------------------- | ------------------------------- | ------------------------------------------------------------ | 28| -i [interval] | Sets the interval (in ms) for checking the Out Of Memory (OOM) thread task.| [100, 10000] | 29| -m [mem byte] | Sets the low memory threshold (in MB). | 0 to 1<br>The value **0** means not to perform the low memory threshold check. | 30| -r [mem byte] | Sets the PageCache reclaim threshold. | Low memory threshold to the maximum available memory of the system<br>Generally, the size of a PageCache is 4 KB. Sometimes, it is 16 KB to 64 KB. | 31| -h \| --help | Displays help information. | N/A | 32 33 34## Usage Guidelines 35 36 If no parameter is specified, this command displays the current OOM configuration. 37 38> **NOTE**<br> 39> If the system memory is insufficient, the system displays a message indicating the insufficiency. 40 41 42## Example 43 44Run the following commands: 45 46- oom 47- oom -i 100 48 49 50## Output 51 52Example 1: The OOM configuration is displayed by default. 53 54 55``` 56OHOS:/$ oom 57[oom] oom loop task status: enabled 58 oom low memory threshold: 0x80000(byte) 59 oom reclaim memory threshold: 0x500000(byte) 60 oom check interval: 100(microsecond) 61``` 62 63Information displayed when the system memory is insufficient: 64 65 66``` 67T:20 Enter:IT MEM 00M 001 68[oom] OS is in low memory state 69total physical memory: 0x1bcf000(byte), used: 0x1b50000(byte) ,free: 0x7f000(byte), low memory threshold: 0x80000(byte) 70[oom] candidate victim process init pid: 1, actual phy mem byte:82602 71[oom] candidate victim process shell pid: 3, actual phy mem byte:14950e 72[oom] candidate victim process testsuits app pid: 4, actual phy mem byte:1334598 73[oom] candidate victim process UserProcess12 pid: 12, actual phy mem byte:25951558 74[oom] max phy mem used process UserProcess12 pid: 12, actual phy mem 25951558 75################excFrom: User!#################### 76data abort fsr:0x817, far:0x225af000 77Abort caused by a write instruction. Translation fault, page 78excType: data abort 79processName = UserProcess12 80processID = 12 81process aspace = 0х01000000 -> 0х3f000000 82taskName = threado 83taskID = 22 84task user stack = 0х20e17000 -> 0х20e21000 85pc = 0x93969dc in /usr/bin/testsuits app ---> 0x19f9dc 86ulr = 0x93969cc in /usr/bin/testsuits app ---> 0x19f9cc 87usp = 0х20e20c68fp = 0x20e20c8c 88R0 = 0х20e35000 89R1 = 0x225af000 90R2 = 0x0 91R3 = 0х28e35000 92R4 = 0х0 93R5 = 0х9500000 94R6 = 0х14 95R7 = 0х97822c4 96R8 = 0x970cfa8 97R9 = 0x9090909 98R10 = 0xa0a0a0a 99R11 = 0x20e20c8c 100R12 = 0х0 101CPSR = 0х80000010 102***backtrace beain*** 103traceback 0 -- lr = 0x9242e1c fp = 0х20e20cc4 lr in /usr/bin/testsuits apr 0x4be1c 104traceback 1 -- 1r = 0х92430cc fp = 0x20e20cdc lr in /usr/bin/testsuits app --> 0x4c0cc 105traceback 2 -- 1r = 0x9396ab0 fp = 0x20e20cec lr in /usr/bin/testsuits app -> 0х19fab0 106traceback 3 -- lr = 0x9393eb4 fp = 0x20e20cf4 lr in /usr/bin/testsuits ap --> 0x19ceb4 107traceback 4 -- lr = 0x92427d4 fp = 0x20e20d44 lr in /usr/bin/testsuits app --> 0x4b7d4 108traceback 5 -- 1r = 0x20c4df50 fp = 0хb0b0b0b 1r in /1ib/libc.so - -> 0x62f50 109``` 110 111 112Example 2: The OOM check interval is set to 100 ms. 113 114 115 116``` 117OHOS:/$ oom -i 100 118[oom] set oom check interval (100)ms successful 119``` 120 121 122**Table 2** Output description 123 124| Parameter | Description | 125| ------------------------------------------------------------ | ------------------------------------------------------------ | 126| [oom] OS is in low memory state<br>total physical memory: 0x1bcf000(byte), used: 0x1b50000(byte), free: 0x7f000(byte), low memory threshold: 0x80000(byte) | The OS has low memory.<br>The total physical memory is **0x1bcf000** bytes, **0x1b50000** bytes are used, and **0x7f000** bytes are left.<br/>The current lower memory threshold is **0x80000** bytes. | 127| [oom] candidate victim process init pid: 1, actual phy mem byte: 82602 | The memory occupied by the **init** process is 82602 bytes. | 128| [oom] candidate victim process UserProcess12 pid: 12, actual phy mem byte: 25951558 | The memory used by the **UserProcess12** process is **25951558** bytes. | 129| [oom] max phy mem used process UserProcess12 pid: 12, actual phy mem: 25951558 | The process that uses the most memory currently is **UserProcess12**. | 130| excFrom: User! | The system memory is low, and the **UserProcess12** process fails to apply for memory and exits. | 131