Swap memory

Jupyter Data
1 min readMar 15, 2017

--

(Straight out of http://stackoverflow.com/questions/20111242/how-to-avoid-errno-12-cannot-allocate-memory-errors-caused-by-using-subprocess)

If you are running out of memory, you may want to increase your swap memory. Or you might have no swap enabled at all. In Ubuntu (it should work for other distributions as well) you can check your swap by:

$ sudo swapon -s

if it is empty it means you don’t have any swap enabled. To add a 8GB swap:

$ sudo dd if=/dev/zero of=/swapfile bs=1M count=8192
$ sudo mkswap /swapfile
$ sudo swapon /swapfile

Add the following line to the fstab to make the swap permanent.

$ sudo nano/etc/fstab/swapfile       none    swap    sw      0       0

Removing Swap memory

$ sudo swapoff /swapfile
$ sudo rm /swapfile

Clear Swap & free memory

$ sudo swapoff -a && sudo swapon -a
$ sudo sh -c "echo 1 > /proc/sys/vm/drop_caches"
$ free -h

For Ubuntu 16.04

https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Jupyter Data
Jupyter Data

Written by Jupyter Data

Fastest way to Explore your Data

No responses yet

Write a response