I recently set up XMR-Stak-CPU Miner on my Linux system, and, as listed as a common occurrence in the README (located here), the program failed with the "MEMORY ALLOC FAILED: mmap failed" exit code. I performed the steps required to fix the error as recommended in the README (without logging off and back on as is necessary for changes to take effect), and the program began to work. Later on, after logging off and logging back in, I noticed the miner would once again not start and gave me the same "MEMORY ALLOC FAILED" error in spite of me already performing the fix.

I have no idea what could be causing the program to fail after successfully working for a full day without problem. I have tried changing the /etc/security/limits.conf file back to the original without success.

Any and all suggestions are welcome!


2 Answers 2


It seems (after some troubleshooting and a few direct messages to the author of XMR-Stak-CPU, /u/fireice_uk on reddit) that I've found the solution:

As it turns out, the sudo sysctl -w vm.nr_hugepages=128 command that must be run to fix the "MEMORY ALLOC FAILURE" error must be run every boot.

Hope this helps someone!


Instead of running the sysctl command every boot do this: sudo nano /etc/sysctl.conf and add "vm.nr_hugepages=128" to the bottom of the file.

Credit to CryptocurrencyFreak for this (https://www.cryptocurrencyfreak.com/2017/08/22/monero-mining-xmr-stak-cpu-ubuntu-16-04/)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.