2 GB Should Be Enough For Me

My new EeePC 1201PN netbook has 2 GB of RAM. Call me shortsighted but I feel like “that ought to be enough for me”. I’m not trying to claim that it ought to be enough for everyone. I am, however, questioning the utility of swap space for those skilled in the art of computing.

Technology marches on: This ancient 128 MB RAM module is larger than my digital camera’s battery charger… and I just realized that comparison doesn’t make any sense

Does anyone else have this issue? It has gotten to the point where I deliberately disable swap partitions on Linux desktops I’m using ('swapoff -a'), and try not to allocate a swap partition during install time. I’m encountering Linux installers that seem to be making it tougher to do this, essentially pleading with you to create a swap partition– “Seriously, you might need 8 total gigabytes of virtual memory one day.” I’m of the opinion that if 2 GB of physical memory isn’t enough for my normal operation, I might need to re-examine my processes.

In the course of my normal computer usage (which is definitely not normal by the standard of a normal computer user), swap space is just another way for the software to screw things up behind the scenes. In this case, the mistake is performance-related as the software makes poor decisions about what needs to be kept in RAM.

And then there are the netbook-oriented Linux distributions that insisted upon setting aside as swap 1/2 gigabyte of the already constrained 4 gigabytes of my Eee PC 701’s on-board flash memory, never offering the choice to opt out of swap space during installation. Earmarking flash memory for swap space is generally regarded as exceptionally poor form. To be fair, I don’t know that SSD has been all that prevalent in netbooks since the very earliest units in the netbook epoch.

Am I alone in this? Does anyone else prefer to keep all of their memory physical in this day and age?

10 thoughts on “2 GB Should Be Enough For Me

  1. Robert Swain

    I have 4GB in my laptop and the swap usually remains empty. I have a machine with 6GB RAM in the UK, the only time it ever needed that 6GB was when rendering a scene of Big Buck Bunny in Blender at some stupid resolution for the FFmpeg video wall. And when it actually needed that much and started swapping, it went from 5 minutes per frame to a few hours per frame because, news flash, swapping is sloooooooooooooow.

    If your program requires all your physical memory and then some, you either need more physical memory or the program needs to find a way to limit the amount of RAM it uses (I’m looking at you, Blender).

    I’m somewhat inclined to agree with you. Maybe it makes sense on servers, but I doubt it because if the server is loaded so heavily that all its physical RAM is being used, it’s going to slow to a complete crawl when using swap as well, but what do I know?

    I suppose the point is that whatever you’re doing right now needs to fit in RAM and then swap is just for keeping hold of stuff that doesn’t fit in RAM anymore until you need it again. The issue that has changed is that for basic desktop usage we should be using maybe 10% of our available RAM. If a program needs more than 90%, that 10% doesn’t relatively make much difference and as mentioned before, swapping is sloooow so we don’t want to do that. :)

  2. Reimar

    The problem with swap is that if a program goes berserk that usuall means the whole system becomes unusable and you can’t even kill the misbehaving program.
    Not having a swap means that the OOM killer just gets rid of it (sometimes with some collateral damage, but usually it is quite spot-on).
    Since I am quite obsessive about saving regularly (a remnant from the days of Windows 98, running Delphi 6 and Winamp at the same time would result in regular crashes – don’t ask me how that is even possible) it don’t usually lose anything relevant if the OOM killer gets the wrong program either.
    I’ve been playing with ramzswap (or whatever they renamed it to lately), particularly when running VMs it gives you a little bit extra headroom by compressing if necessary.

  3. SvdB

    When your system starts swapping processes out, it’s going to become unusable anyhow (at least until the OOM-killer kicks in).

    But swap space is also used for [i]paging[/i]. Suppose you have a process which has filled a part of its memory with data, but isn’t using that at the moment (say a service waiting for incoming connection). That memory is wasted. But if the data is paged to disk, the memory can be used in the service of other processes, say for read-ahead cache, or to keep recently accessed data around longer.

    That’s the theory at least. In practice my swap usage is at 0% most of the time as well.

  4. Tim

    I agree. When you get into swap on Linux it is nearly impossible to kill the offending program because everything crawls to a halt.

    And yeah, 2GB should be enough for any ‘office’ use. I have 8 GB though for Matlab and other stuff.

  5. jpc

    I think SvdB is right in that you like sam swap space for programs that allocate RAM they don’t use or just for rarely used programs. It’s still faster to load from swap than to start the program from scratch. OTOH I think swap is a bad idea on SSD/Flash and when disk space is low.

    After several days on my Mac I have around 1GB of swap used (with 4GB of RAM) and I only use quite well behaved programs (i.e. nothing from Adobe ;).

    PS. The question remains why only Linux wants to have it’s swap memory on another partition and not in a normal file.

  6. Bastien

    @jpc: swapping to a file can cause deadlocks pretty easily. What do you do when an app needs RAM to write a file to the filesystem, but you don’t have enough RAM. So you’d have the filesystem needing RAM to write the swap, which you don’t have in the first place.

    @bramp: yeah, you need swap to use hibernate, which sucks :(

    At the end of the day, you should not have swap on SSD systems, have some on rotary disks (for paging), and not need it for hibernate, and not need to set it up because it could be on the root filesystem.

  7. Mans

    My main machine with 12GB RAM has no swap and doesn’t seem to be suffering from the lack thereof. The laptop with 8GB RAM has about 4GB swap so it can hibernate. I haven’t seen the swap space being used otherwise.

    @jpc: Linux can use a swap file just fine.

  8. Multimedia Mike Post author

    @SvdB: I would assert that your proposed scenario is not as big of an issue, at least on Linux, due to memory overcommit. Essentially, in most default kernel configurations, malloc() never returns false. The kernel claims to allocates whatever RAM a program asks for since it assumes that the program will never actually try to use everything it asks for.

    Sure, bad things happen when all of that memory debt gets called in. But it seems to work find most of the time.

  9. Reimar

    @Mike: that “bad things” is the OOM killer. And I tend to consider it a good thing, since with several GB of RAM I have rarely seen it kill anything that didn’t deserve it.

    @SvdB: I prefer my system to be always usable over a small performance gain due to having swap available. But yes in theory there is speed advantage.

    And yes, creating a swap file and attaching it at runtime with swapon is a useable method if you once actually do need more RAM than you have installed.

Comments are closed.