DEV Community

Waylon Walker
Waylon Walker

Posted on • Originally published at waylonwalker.com

5 1

Create a Swapfile on Your Linux Machine

If you ever end up on a linux machine that just does not have enough ram to suffice what you are doing and you just need to get the job done you can give it some more swap. You can look up reccomendations for how much swap you should have this is more about just trying to get your job done when you are almost there, but running out of memory on the hardware you have.

make the /swap file

You can put this where you wish, for this example I am going to pop it into
/swap

sudo fallocate -l 4G /swap sudo chmod 600 /swap sudo mkswap /swap sudo swapon /swap
Enter fullscreen mode Exit fullscreen mode

make sure that your swap is on

You can make sure that your swap is working by using the free command, I like using the -h flag to get human readable numbers.

❯ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       5.5Gi       4.9Gi       458Mi       5.2Gi       9.3Gi Swap:          4.0Gi          0B       4.0Gi
Enter fullscreen mode Exit fullscreen mode


article cover for <br>
 Reclaim memory usage in Jupyter<br>


Reclaim memory usage in Jupyter


I also used this trick in this article to give my python process a bit more oompf and get it on home.

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay