Skip to content

Linux – 指令: MEMTESTER

memtester(8) Maintenance Commands memtester(8)

NAME

memtester – stress test to find memory subsystem faults.

SYNOPSIS

memtester [-p PHYSADDR [-d DEVICE]] <MEMORY> [ITERATIONS]

DESCRIPTION

memtester is an effective userspace tester for stress-testing the mem‐
ory subsystem. It is very effective at finding intermittent and non-
deterministic faults. Note that problems in other hardware areas
(overheating CPU, out-of-specification power supply, etc.) can cause
intermittent memory faults, so it is still up to you to determine where
the fault lies through normal hardware diagnostic procedures; memtester
just helps you determine whether a problem exists.

memtester will malloc(3) the amount of memory specified, if possible.
If this fails, it will decrease the amount of memory requested until it
succeeds. It will then attempt to mlock(3) this memory; if it cannot
do so, testing will be slower and much less effective. Run memtester
as root so that it can mlock the memory it tests.

Note that the maximum amount of memory that memtester can test will be
less than the total amount of memory installed in the system; the oper‐
ating system, libraries, and other system limits take some of the
available memory. memtester is also limited to the amount of memory
available to a single process; for example, on 32-bit machines with
more than 4GB of memory, memtester is still limited to less than 4GB.

檢測容量只能小於RAM總量,32位元系統檢測容量無法大於4GB

Note that it is up to you to know how much memory you can safely allo‐
cate for testing. If you attempt to allocate more memory than is
available, memtester should figure that out, reduce the amount
slightly, and try again. However, this can lead to memtester success‐
fully allocating and mlocking essentially all free memory on the system
— if other programs are running, this can lead to excessive swapping
and slowing the system down to the point that it is difficult to use.
If the system allows allocation of more memory than is actually avail‐
able (overcommit), it may lead to a deadlock, where the system halts.
If the system has an out-of-memory process killer (like Linux),
memtester or another process may be killed by the OOM killer.

So choose wisely.

如果檢測容量大於當前非使用中的容量,memtester應會自動減小檢測容量。

若檢測造成RAM飽和,可能導致其他程式將資料寫入硬碟,造成系統緩慢。

若系統允許檢測容量大於RAM總量,可能導致當機。

有些系統則會在RAM不夠程式要求的分配量時,刪除該程式 (比如 Linux)

OPTIONS

-p PHYSADDR

tells memtester to test a specific region of memory starting at
physical address PHYSADDR (given in hex), by mmap(2)ing a device
specified by the -d option (below, or /dev/mem by default).
This is mostly of use to hardware developers, for testing mem‐
ory-mapped I/O devices and similar. Note that the memory region
will be overwritten during testing, so it is not safe to specify
memory which is allocated for the system or for other applica‐
tions; doing so will cause them to crash. If you absolutely
must test a particular region of actual physical memory, arrange
to have that memory allocated by your test software, and hold it
in this allocated state, then run memtester on it with this op‐
tion.

特定的RAM地址(16進位)

MEMORY

the amount of memory to allocate and test, in megabytes by de‐
fault. You can include a suffix of B, K, M, or G to indicate
bytes, kilobytes, megabytes, or gigabytes respectively.

要檢測的記憶體容量,預設是MB

ITERATIONS

(optional) number of loops to iterate through. Default is infi‐
nite.

檢測次數

ENVIRONMENT

If the environment variable MEMTESTER_TEST_MASK is set, memtester
treats the value as a bitmask of which tests (other than the stuck ad‐
dress test) to run. The value can be specified in decimal, in octal
(with a leading 0), or in hexadecimal (with a leading 0x). The spe‐
cific bit values corresponding to particular tests may change from re‐
lease to release; consult the list of tests in the source for the ap‐
propriate index values for the version of memtester you are running.
Note that skipping some tests will reduce the time it takes for
memtester to run, but also reduce memtester’s effectiveness.

NOTE

memtester must be run with root privileges to mlock(3) its pages.
Testing memory without locking the pages in place is mostly pointless
and slow.

EXIT CODE

memtester’s exit code is 0 when everything works properly. Otherwise,
it is the logical OR of the following values:

若檢測結果為 0,代表沒有錯誤。以下錯誤碼各代表:

x01 error allocating or locking memory, or invocation error

分配記憶體錯誤,鎖定記憶體錯誤,調用錯誤

x02 error during stuck address test

執行記憶體地址檢測時發生錯誤

x04 error during one of the other tests

執行其他檢測時發生錯誤

AUTHOR

Written by Charles Cazabon.

REPORTING BUGS
Report bugs to <[email protected]>.

COPYRIGHT

Copyright © 2001-2012 Charles Cazabon
This is free software; see the file COPYING for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

memtester 4 June 2012 memtester(8)

(資料來源,終端對於 memtester 的說明:man memtester)

實際應用,延伸閱讀:Ubuntu 20.04 MEMTESTER 檢測 Ram

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料