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.

  • vortexal@lemmy.mlOP
    link
    fedilink
    arrow-up
    1
    ·
    21 hours ago

    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
      link
      fedilink
      English
      arrow-up
      1
      ·
      6 hours ago

      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.

    • HelloRoot@lemy.lol
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      8 hours ago

      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.