3

Okay so I have 7.7 GiB of memory usable and i'm only using about 2.3 GiB at most, and some of my programs that I run are still very laggy, is there a way to allocate more memory into a certain program so I can minimize the lag. I'm a bit new to Ubuntu.

EDIT: I should probably say that the programs are mainly games.

2
  • 5
    Each application is free to occupy as much RAM as it wants, as long as the system has enough free available (with a limit of 4GB per process on 32 bit systems, bit 64 bit should be far beyond that). You can't "force" an application to use more RAM than it wants. What should it do with it? You have to find out what the actual bottleneck is - does the application slow down because of disk I/O, network I/O, heavy graphics rendering, CPU usage, ...?
    – Byte Commander
    Apr 22, 2018 at 23:24
  • Games generally work faster in Windows if that was the reason for your question. Apr 23, 2018 at 22:12

2 Answers 2

1

If you know the program names your application uses you can put this in your startup applications:

cat /<path-to-app-1>/<prog-name-1> > /dev/null
cat /<path-to-app-1>/<prog-name-2> > /dev/null
cat /<path-to-app-1>/<prog-name-3> > /dev/null
    (... SNIP ...)
cat /<path-to-app-9>/<prog-name-9> > /dev/null

Additionally if your applications has large configuration files you can speed up access to them in startup applications as well using:

cat /<path-to-config1>/<config_file-1 > /dev/null

If after preseeding the caches above, you wish to clear them out and regain RAM, you can create and run this bash script:

#!/bin/bash
if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi
sync; echo 1 > /proc/sys/vm/drop_caches
sync; echo 2 > /proc/sys/vm/drop_caches
sync; echo 3 > /proc/sys/vm/drop_caches
0
0

If you are talking about load time, you can use something called as Preload. Preloading is the action of putting and keeping target files into the RAM. The benefit is that preloaded applications start more quickly because reading from the RAM is always quicker than from the hard drive. However, part of your RAM will be dedicated to this task, but no more than if you kept the application open. Therefore preloading is best used with large and often-used applications like Firefox and LibreOffice.

You can install it by typing the following command.

sudo apt install preload

You must log in to answer this question.

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