I'm trying to maximize the performance of a game, and if it access to the swap memory the fps drops. Is there a way to "block" the swap memory for a specific program? For the moment i reduce the swappiness value until the use of ram is not enough for start to use the swap, but it is highly unstable, also my pc is a low-end one it has 2gb ram, when i start the game only the ram hits the 95% also i put the game in -20 niceness so the freezing possiblity grows a lot.

Any help is good help :)

  • What version of Ubuntu are you using?
    – David
    Commented Apr 7, 2021 at 14:24
  • 1
    Seems like you have already explored the available parameters. There is no per-process swap-blocker, Time to invest in additional RAM.
    – user535733
    Commented Apr 7, 2021 at 14:27
  • Without the source, no.
    – waltinator
    Commented Apr 7, 2021 at 14:30
  • @waltinator I wonder if it would be possible with the source? Swap is managed at the OS system level, without interference of the processes themselves.
    – vanadium
    Commented Apr 7, 2021 at 15:03
  • 1
    @vanadium thank you bro, yeah i know that i need more ram but i have no money, so i have to work with what i have, also i'm working on a extensive guide of how to well play this game on a low-end pc. Really thanks PD: it would be great to can do what i asked for, it'd great for maximize the performance, anyways thanks! Commented Apr 7, 2021 at 18:16

1 Answer 1


The operating system has no provisions to allow you to indicate selectively what processes can be swapped and what cannot. What you did is the best you can do: decreasing swapiness. To make sure your game does not use swap, you could temporarily disable swap (sudo swapoff). Based on your description, however, your system will then likely crash because it probably will run out of memory. With swap, it will not crash, but eventually start to be very slow, because chunks of physical memory are swapped back and forth to the much slower hard drive.

End conclusion: run a less memory consuming game or buy more physical RAM.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .