• SleveMcDichael@programming.dev
    link
    fedilink
    English
    arrow-up
    25
    ·
    edit-2
    21 hours ago

    Please, for the love of who ever you hold in high esteem, use swap. See: https://chrisdown.name/2018/01/02/in-defence-of-swap.html Now I don’t really like the whole “Heres an article from some rando to prove my point” thing, but anecdotally, the article does line up with my experience (with 32 gigs of system memory). Namely, when I went without swap I experienced frequent system lock-ups, when I added swap on zram, lock ups still happened but less frequently, and when I eventually changed swap on zram to disk swap on the recommendation of this article lock ups never happened again.

    • kopasz7@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      16
      ·
      22 hours ago

      To add some nuance to this, do not use ZRAM in combination with swap. There’s ZSWAP for that which does what you would expect, without clogging up your RAM and gracefully handling a backing device. (ZRAM is just another block device for the kernel, so you will get LRU inversion if it fills up and you have another layer of swap on disk. Meaning your cold pages will be needlessly stuck in zram.)

    • twack@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      ·
      4 hours ago

      If you run out of RAM and have swap disabled, then some program must be killed to make room. That’s handled by OOM (out of memory).

      Whatever got killed might have been important, and you as the user don’t get to pick at that point.

  • DraconicSun@piefed.social
    link
    fedilink
    English
    arrow-up
    11
    ·
    20 hours ago

    Sorry, my 8 GB study laptop freezes all the time on Librewolf and it has a Bay Trail chip. I gotta have it.

    • Junkers_Klunker@feddit.dk
      link
      fedilink
      arrow-up
      3
      ·
      15 hours ago

      You must have a bajillion tabs open, until recently I used an old thinkpad with 8gb of soldered ram and never ran into ram issues with only librewolf running. It was a different story though when I started qGIS and a couple of libreoffice instances.

      • DraconicSun@piefed.social
        link
        fedilink
        English
        arrow-up
        1
        ·
        5 hours ago

        I usually have VSCode, Discord and MusicBee (with Wine) open in the background, but yeah I just open a bunch of tabs sometimes. I did make a swap file and not a partition however.

  • 𝘋𝘪𝘳𝘬@lemmy.ml
    link
    fedilink
    arrow-up
    46
    arrow-down
    1
    ·
    1 day ago

    Remember when they said “swap should be 2 times the amount of RAM”.

    Why would I waste 128 GiB of storage for nothing?

    • That’s why whenever I’ve upgraded PC I always tried to double or more than double the amount of RAM my last PC had. So this last upgrade I went from 16 GiB to 64 GiB. DDR4 though. I doubt I’ll be able to double it next time with these prices though.

    • FlexibleToast@lemmy.world
      link
      fedilink
      English
      arrow-up
      16
      ·
      18 hours ago

      They stopped saying that a long time ago. It became something like 2x ram until beyond 4GB then it was something more sane.

    • istdaslol@feddit.org
      link
      fedilink
      arrow-up
      13
      arrow-down
      2
      ·
      1 day ago

      Did the same thing but some apps are designed with that in mind and I had worse performance so had to do a swap file again

  • RiQuY@lemmy.zip
    link
    fedilink
    arrow-up
    8
    ·
    edit-2
    10 hours ago

    Everytime I install a fresh OS I setup swap when I feel I’m having OOM issues or random freezes, it’s just creating one 16GB file and enabling it as swap. Much easier than going to read now about zswap zram or whatever I’m “supposed” to be using.

  • TootSweet@lemmy.world
    link
    fedilink
    English
    arrow-up
    31
    ·
    1 day ago

    I know right now you’re stuck exclusively using swap, but If you work hard and apply yourself, you may one day be able to afford one whole gigabyte of ram without going more than five figures into debt.

  • GottaHaveFaith@fedia.io
    link
    fedilink
    arrow-up
    1
    ·
    12 hours ago

    I have a laptop with 16GB of ram and discovered that if I connect an external display the available ram goes down to 12… but I’d hate to pay 32 GB as if they were 256 GB, I’ve resigned to keeping 1 (one) instance of intellij opened at a time

    • kopasz7@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      14
      ·
      21 hours ago

      Even if you don’t run out of RAM your kernel will use swap to defragment your memory. Usually you end up with gaps in memory that are too small to effectively allocate as programs open, close or stay running over time.

      • Scoopta@programming.dev
        link
        fedilink
        arrow-up
        7
        ·
        21 hours ago

        That’s ok, I have enough RAM that I’m not particularly worried about that either. I also don’t leave my computer on all night, I like to be nice to my tech, also locks my drives

    • marcos@lemmy.world
      link
      fedilink
      arrow-up
      17
      ·
      1 day ago

      If you need swap, you probably should look at the tradeoffs of a file vs. a partition, or maybe even adding another entire disk.

      But if you don’t know if you’ll need it, it’s because you won’t.

    • Auth@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      ·
      16 hours ago

      dont worry Samsung zNAND-O is coming to fill the gap at unaffordable prices.

  • ArsonButCute@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    16 hours ago

    I often use FreeBSD on a system with 2 gigs of ram. I WISH swap was useful. OOM killer is so overzealous the thing just kills whatever before even touching swap.

  • MNByChoice@midwest.social
    link
    fedilink
    arrow-up
    6
    ·
    22 hours ago

    Great send up of Swap!

    Swap is great though. And to point out again that there are ratings on quality SSDs for the lifetime writes. Pull up the data sheet and look for “DWPD”, which is “Disk Writes Per Day”. Typical numbers for good swap drives are 1 and 3. If DWPD is not listed, then plan for frequent drive failures if using heavy, heavy swap (like for ZFS swap drives (Yes, these are different from a OS swap partition)).

    Anyway, I just wanted to point out the DWPD statistic.