Sign up ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Trying to test as much of my 8 GB of RAM as possible with memtester, I encountered a hangup in single user mode, but not when running memtester on my admin user account.

vm_stat is used to calculate the maximum number of bytes memtester is going to mlock (see below).

If Pages inactive and Pages speculative are removed from the calculation, /memtester (see below) works in single user mode as well.

Any ideas why /memtester with maximum number of bytes hangs in single user mode?

Does /memtester hang on your Mac in single user mode as well?


# my memtester setup (iMac running Mac OS X 10.6.8)

# set kernel to 64 bit
[[ $(systemsetup -getkernelbootarchitecturesetting) != *x86_64* ]] && 
    sudo systemsetup -setkernelbootarchitecture x86_64
# reset kernel to 32 bit with: 
# sudo systemsetup -setkernelbootarchitecture i386

# get memtester
# requires MacPorts,
sudo port install memtester  

# cat /memtester
echo '
n1=$(vm_stat | awk '\''BEGIN{sum = 0;} /Pages free|Pages inactive|Pages speculative/{sub(/\.*$/,""); sum+=$NF} END{print sum}'\'')
n2=$(getconf PAGESIZE)
bytes=$((n1 * n2))
/opt/local/bin/memtester ${bytes}B 2
' | sudo tee /memtester

sudo chmod +x /memtester

# works on my admin user account
sudo /memtester 

# hangs in single user mode (computer started with cmd-s keys pressed)

want 7797MB (8176353280 bytes)
got  7797MB (8176353280 bytes), trying mlock ...   
# <--- memtester hangs here in single user mode
#      press ctrl-c repeatedly or the power button
#      for at least 5 seconds to abort
share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.