• topperharlie@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    1 month ago

    Everyone defending swap like crazy in the comments… so let me give a counter argument specifically for desktop:

    Many years ago I stopped using swap on all my computers (I exclusively use linux) and the reason is: every time anything regarding interactivity went to swap, my system would freeze and literally become unusable for a really long time until I killed something. Since I got tired if that behaviour I decided I prefer for random shit to die but my computer still be usable.

    It wasn’t very often, but I don’t get OOM killer often either (as in I don’t remember the last time it happened and I use linux every day for both work and fun), and the freezing situation was way more annoying, to the point I sometimes ended up cold switching off the computer. I’m surprised on how many people run out of memory constantly. I guess you all are just using linux for servers and have crazy processing of infinite data…

    • JamesBoeing737MAX@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      Or shotcut. I once ran it on 8GB, minimal arch with no swap. Well.

      And I’m not even trying to build android on my new relatively modern laptop. It won’t work.

      • topperharlie@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        1 month ago

        yep it was HDD, but with the low amount of times I have any OOM issue, I’m way more worried about NVMe flash burning than a random process being killed once every blue moon.

        In fact I didn’t mention, but since the advent of flash drives what I’ve done is trying to locate heavy disk writing apps and find alternatives for them, amid disabling many logs.

        For swap, it hunts me to think some automatic process I don’t have control over will burn those sweet erase cycles without me noticing just because someone programmed it poorly. I’m way more happy knowing I have some control over it.

  • 18107@aussie.zone
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    No

    15.5/15.5 GB RAM used, plus 16.8/465GB swap

    It turns out the computer mostly freezes once you go past 200% RAM used.

      • 18107@aussie.zone
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 month ago

        Trying to ray-trace a 512,000x256,000 image using Chunky. I had to split it into 16 parts to reduce the RAM to a sane amount (in 2018, it may have been optimised since).

        I was trying to find the limit for a single png, and I think I found it.

      • fuck_u_spez_in_particular@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        1 month ago

        16GB are my usual breakfast, I’ll fill that quickly after booting… I’m happy that I got 64GB, though even that is often used up, thus I sometimes wish for 128Gb though (and for running somewhat capable local LLMs 512GB would be even better…).

        Bottomline: ypu can basically never have enough RAM…

    • palordrolap@fedia.io
      link
      fedilink
      arrow-up
      0
      ·
      1 month ago

      I actually did this for a laugh a very, very long time ago. I had upgraded my 75MHz Pentium machine from 8MB to a whopping 40MB, so since I knew it would run fine with just 8, I installed a TSR RAMdisk and told Windows 3.1 to put its swap on that drive.

      It worked great, but I decided I’d rather use the memory for other things.

      But in more modern times, I’ve literally forced browser caches into memory-based tmpfs to take the load off system disks, which is basically the same thing. And it reduces wear on my hardware.

  • Buddahriffic@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    1 month ago

    The trick is to first create a RAM disk. Then put the swap file on there and it’s about as fast as RAM. Then, with the new memory you have created, make another RAM disk. Yep, then make more swap space on there.

    I have solved both the memory and SSD availability issues with this infinite RAM and disk space trick.

    • cannedtuna@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      Used a website to make the windows since I was on mobile. Thought it looked too plain w/o the window decorations, but yeah. I mean there’s so many distros and themes, who’s to say it couldn’t be Linux. I’ve seen KDE reskinned to look like OSX

      • alecsargent@lemmy.zip
        link
        fedilink
        arrow-up
        0
        ·
        1 month ago

        It’s fine, I really like MacOS X too. To be fair those window decorations looks real nice as demos.

    • zitrone 🍋@europe.pub
      link
      fedilink
      arrow-up
      0
      ·
      1 month ago

      right real linux user do everything in the tty and maybe put something in the framebuffer if they want to view an image or similar

  • rem26_art@fedia.io
    link
    fedilink
    arrow-up
    0
    ·
    1 month ago

    Building a PC in 2026 be like “I cant afford RAM, but I can use a whole TB hard disk I shucked from an old WD external as swap and maybe my PC will feel modern”

  • 0x0@lemmy.zip
    link
    fedilink
    arrow-up
    0
    ·
    1 month ago

    My 64GiB are enough for my tasks, i don’t use swap.
    I may consider it for laptops but only for hibernation purposes.

  • motruck@lemmy.zip
    link
    fedilink
    arrow-up
    0
    ·
    1 month ago

    Swap is there an emergency relief for when a runaway process starts to eat all the resources. The system gets slow the user says hey what’s that? They look and see oh wow this one process is really eating a lot of resources that’s bad, can I kill it or do I need to gracefully try to shut it down. Swap buys you time when it could matter. When you don’t have swap OOM killer takes out whatever it wants and for a desktop user that may not be that big of a deal but for a server the database is likely the first target that is taken out.

    • nullptr@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      1 month ago

      you misunderstand the meme (of course it doesn’t help either); because the alternative isn’t “no swap”, but rather “use a swap file instead of swap partition”

  • azimir@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    1 month ago

    I have a small home server that I occasionally push through huge batch processing jobs. During the pushes, I might collide with other projects that use a pretty big chunk of the RAM. So, to make sure it’s never a killer (just a major slow down), I made a 32GB swap file. If I need it, it’s there and disk is hella cheap.

    This machine has never had a GUI installed. No browsers to complain about, just plain old data processing, stats models, and old skool computing.

    Now, my worst case scenario was building a C++ program on a raspberry pi gen 1. That has 256MB of RAM. g++ ran out building, so I NFS mounted a huge disk from my desktop machine and made the swap file there. The build took a while… but the program ran fine after the week long build, no swap needed.

    • cannedtuna@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      Shit did I botch it? I made this on my phone and the toot I copied the script from was just text. Wanted to make it look more interesting so I found this site that let you make the windows. I just went with what I thought looked best.

  • Zenorbi@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    1 month ago

    I used to be this guy. We have huge amount of memory in our storage server. Why would we need swap? Well, once the system started killing programs I read up on swap and how the system handles its caches, especially ZFS ARC.

    Short version is that while the system can evict its caches syncronously, it can only async notify ZFS that it should also shrink its caches, but the out-of-memory killer will start killing before ZFS and its kernel counterpart can start to free up memory.

    A tiny bit of swap completely solved this, since swapping is sync for the kernel and the OOM killer will wait for it.

    • Fizz@lemmy.nz
      link
      fedilink
      arrow-up
      0
      ·
      1 month ago

      As well as oom situations, swapping allows the memory to be used more effectively by swapping out anonymous pages that aren’t likely to be used but can’t be dropped.

    • grrgyle@slrpnk.net
      link
      fedilink
      arrow-up
      0
      ·
      1 month ago

      I found that with swap the applications would slow to a crawl and then basically lock up entirely until I hauled my ass over and manually power cycled the machine.

  • provectus@lemmy.ml
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    Then what is the setup if my computer only has 4GB of memory for daily driving? Just curious because swap partitions are what I normally do on limited resource machines.

    • muhyb@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      1 month ago

      Eh, it’s fine. That’s what I do with 4 GB RAM as well. However even though I set 8 GB swap on that machine I noticed it’s hardly using the half of it at most. (Using Void Linux)

    • mlg@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      Dunno how well zswap handles at that size, but the point is that is compresses swap into RAM, so it would use a max of 819.2M for a total of 2457.6M of swap space. If you need more, then by all means, use a swap file or partition lol.

      Actually linux easily supports multiple and tiered swap mounts, so you could even go zswap + ssd swap + hdd swap, or a cheapo “burn at your own risk” usb flash swap lol.

      • WhyJiffie@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 month ago

        so it would use a max of 819.2M for a total of 2457.6M of swap space.

        calling it total is a bit of a stretch. that’s the best case scenario, when the contents compress well.

        also, zswap might not be a good idea on that system. if it only has 4 GB RAM, it likely has a CPU tht is slower and has only a couple cores, and the modern web is cpu heavy enough as it is

      • provectus@lemmy.ml
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 month ago

        That is pretty cool. Did not know that. Will still be keeping my partition because it works fine for me.