this post was submitted on 28 Feb 2026
26 points (96.4% liked)

Linux

63443 readers
594 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS
 

If you're not aware of what preload is, it's a command line application that allows you to add files to ram, so they can be accessed faster by the applications that need them.

It seems to work well for what I'm using it for, which is to run games from slower storage devices, but there doesn't seem to be any documentation for a proper way to remove the files once they've been added to ram. What I've been doing is to just use htop to terminate the preload command, but I feel like this is not intended at all. Is there a better way to remove these files?

I should mention that while trying to search for a solution myself, I did see gopreload mentioned a few times. I would try this out myself, but there's no proper installation instructions, at least not any I could find that work in Linux Mint.

top 11 comments
sorted by: hot top controversial new old
[–] RIotingPacifist@lemmy.world 14 points 2 days ago (2 children)

My understanding is the kernel will remove them if it needs the ram, so there is no need unless it's for security reasons.

[–] MonkderVierte@lemmy.zip 2 points 2 days ago

Usually, RAM space gets reserved, it doesn't get removed then.

[–] vortexal@lemmy.ml 4 points 2 days ago (1 children)

When you say "remove", do you mean completely remove or move them to swap/zswap/zram, depending on what the system has enabled?

[–] RIotingPacifist@lemmy.world 12 points 2 days ago

Cached files are freeable so the kernel will drop them instead of sending them to swap.

And I'm pretty sure zram is just a swap device in RAM so should follow the same rules.

[–] HelloRoot@lemy.lol 9 points 2 days ago (1 children)

Are we talking about this preload?

https://manpages.ubuntu.com/manpages/jammy/man8/preload.8.html

Cause if so, it doesn't actually let you manually add specific files to RAM. It's an adaptive daemon that automatically learns which files your applications use frequently over time and prefetches them. So when you launch it and then play games, it's observing patterns and making predictions.

This also explains why there's no "remove files" command. The files preload loads into RAM aren't locked there; they're in the page cache, which the kernel manages freely. If something else needs that memory, the kernel will evict those cached files automatically. Killing preload via htop should not really do anything, except it not doing it's thing anymore.

[–] vortexal@lemmy.ml 2 points 2 days ago (2 children)

When I used preload, it let me manually add files to ram. I used sudo preload filename for each file (the game I tried it with only had two) and it seemed to add them to ram. I know this because the game had hitching issues even after just adding the main executable but the hitching went away when I added the second file.

[–] atzanteol@sh.itjust.works 1 points 2 days ago (1 children)

When you open and read files from a program the OS (kernel) will typically cache part or all of those files in memory. This is to speed up subsequent reads of that file since disk access is slow.

"preload" seems to be making use of that feature.

The kernel maintains this cache and evicts (unloads) things from it as needed. You don't need to worry about it.

[–] vortexal@lemmy.ml 1 points 1 day ago

After doing some more "extreme" tests, it seems like I was wrong about how preload works. In fact, it didn't seem to actually preload the files at all, so I'm not sure what it actually does. I ran sudo sysctl vm.drop_caches=1 to make sure that none of the game's files were loaded and then used preload like I did yesterday, but the game still has hitching issues. This means that the game's files were probably still loaded in RAM when I was trying it yesterday.

[–] HelloRoot@lemy.lol 2 points 2 days ago* (last edited 2 days ago) (2 children)

This doesn't really prove it.

Running ths game multiple times will do the same, because the pages will stay cached. Operating systems are smart with RAM. Things that were recently used stay in RAM, even though the OS reports it being "free". Read this for some more info: https://www.linuxatemyram.com/

And preload might swallow the filepath arg without doing anything with it.

Instead you could share the output of

preload --help
preload --version
sudo preload --verbose
# followed by running a game

What you describe can actually be done with another tool https://hoytech.com/vmtouch but not with preload.

[–] vortexal@lemmy.ml 2 points 1 day ago

After trying vmtouch, it only seems to be partially helping. I'm not sure if I'm just using it incorrectly or not but if I remove the files from RAM and then use vmtouch to add them back in, the hitching issues are still partially there.

To fully explain what my issue is, I currently using the Linux version of the Cyber Lancer demo from Itchio as it's small enough to fit onto my 128 MB SD card, which is very slow. I can easily run the game from other storage devices that have much higher read speeds but I want to get the most out of my older and slower storage devices. What's happening is when the game first loads when it's files aren't stored in RAM, is the game essentially freezes for a split second every time it has to load an asset that wasn't previously loaded.

vmtouch isn't making the hitching go away, it just making it load a little faster. This does mean that it'll help but if you're aware of a better solution, I can try that out as well.

[–] vortexal@lemmy.ml 1 points 1 day ago

That wont be necessary, after doing more "extreme" tests with preload, it seems like I was wrong about preload. I used sudo sysctl vm.drop_caches=1 to make sure that none of the game's files were loaded in RAM before using preload like I did yesterday, but the game still has hitching issues. This means that the game's files were probably still loaded in RAM when I was testing it yesterday.

For context, what I'm trying to do is find a way to run smaller games more smoothly from some very old storage devices that are very slow. I thought that preload would be the solution but since it doesn't seem to actually do what I thought it did, I'm going to need a different solution. I will try vmtouch and respond back if it works.