8

When I'm playing minecraft, my computer often has to swap because Google Chrome takes much RAM, too. So, I'd like to manually swap out Google Chrome. I know that I can temporarily stop all its processes with SIGSTOP, but how can I force them into swap? Or is that a bad idea?

4 Answers 4

5

Maybe try a command like this to temporarily use a lot of memory to force Chrome (and everything else) to swap out before starting minecraft

dd if=/dev/zero conv=block cbs=1024m of=/dev/null bs=32m count=32
3
  • Your answer and Wyzards are both good, don't know which one to accept :D
    – thejh
    Commented Mar 30, 2012 at 18:17
  • Give my suggestion a try and if it doesn't help minecraft responsiveness you should accept Wyzard's answer. Commented Mar 31, 2012 at 3:12
  • Well, as the problem only occurs from time to time, I can't really test based on that, but I've seen that while minecraft was running, I had 500MB free RAM, so it looks like this is a good idea.
    – thejh
    Commented Mar 31, 2012 at 10:50
6

I wouldn't bother; other processes will be paged out automatically when there's memory pressure. The kernel uses a "least-recently-used" scheme for deciding what should be paged out next, and if you stop Chrome with SIGSTOP, it won't be able to use any of its pages, so after awhile they'll be kicked out of RAM if Minecraft needs more.

1
  • Your answer and Brians are both good, don't know which one to accept :D
    – thejh
    Commented Mar 30, 2012 at 18:17
0

If you're using them both at once thats probably a bad idea. Constant adding and removing from swap will cause thrashing which is not only bad for your hard drive, but slow.

As far as I know it is not possible, swap space is managed by the kernel. You can however mount a ramdisk as a directory if you have the spare ram.

0

If you're seriously determined to run Chrome while gaming then I'd suggest digging into chrome's threads and choosing what you need running (a lot of individual threads are simply one extension constantly running) and freeze the rest right after clearing your ram. With the way chrome sandboxes everything it makes it pretty stable even if you start freezing parts of it as long as the main portion (which isn't that big alone) isn't messed with.

I'd also consider throwing in a few cpulimit commands as well so the processor demand coming from chrome doesn't make it look like the top priority for caching.

If you're using chrome for push notifications or anything that is incremental then incrementally pausing and resuming it may be a lot of help as well if you only allowed enough time for it to fetch what it needs.

One last suggestion I've done a few times before is having a set interval set up that clears the ram of processes that aren't that important in terms of preformance for you and have that interval set under a "self.cpulimit" function because depending on which command you choose, some of them can get pretty cpu heavy.

You must log in to answer this question.

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