Advanced

All about Linux swap space

Posted by Scott_Ruecker on · 30 comments
Linux.com; By Gary Sims
Mail this story
Print this story

When your computer needs to run programs that are bigger than your available physical memory, most modern operating systems use a technique called swapping, in which chunks of memory are temporarily stored on the hard disk while other data is moved into physical memory space. Here are some techniques that may help you better manage swapping on Linux systems and get the best performance from the Linux swapping subsystem.

Full Story

  Nav
» Read more about: Story Type: News Story; Groups: Linux

» Get new stories by e-mail: nightly or as they are published

« Return to the newswire homepage

  Related stories
» More like this

Comments (30)

10 earlier comments in the full thread.

> Firefox _still_ has Netscape's memory leak problem?

It has at least one memory leak problem. Whether it's one of the many Netscape had is debatable.
"It is a logical fallacy to go from 'everyone must submit their arbitration to a 3rd party' to 'there must be a 3rd party to which everyone submits their arbitration'."

So that makes perfect sense. It has at least one memory leak, but there is no way to know that it/they are the same memory leak(s). Very likely why I use Konqueror for everything for which Konqueror works.

:^)

I couldn't help it, it just came out.

GNOME + Konqueror? That would be cool.
I doubt the Firefox memory consumption is actually a "leak". It's retaining a history of pages and closed tabs, as well as pre-rendered stuff. This was touted as a "feature" in FF2, to help speed things up.
Ah yes, the old "It's not a bug, it's a feature." quip.
> GNOME + Konqueror? That would be cool.

Debian. GNOME and KDE apps run just fine together, on whatever "desktop".
Quoting:I doubt the Firefox memory consumption is actually a "leak". It's retaining a history of pages and closed tabs, as well as pre-rendered stuff. This was touted as a "feature" in FF2, to help speed things up.


I'll have to double check when I get home, but I believe I have the tab history disabled as well as page caching, so it should only be retaining page history.

And I doubt that would amount to 600MB+ of RAM usage over the course of a few days. :)
Whatever it is, gus, it made Firefox unusable for me because the sucker would cause slowdowns and then hard lockups on my nice Linux boxes. And the dev team are a big bunch of wankers, because users have been complaining about this for years, and filing bug reports, which were dismissed with a huffy 'well it's not a memory leak, so buzz off', instead of trying to figure out why it was misbehaving. Linux Firefox users are unwanted stepchildren, anyway.
> And I doubt that would amount to 600MB+ of RAM usage over the course of a few days.

I've seen the effects of letting Firefox run for more than two days first hand. Something is definitely chewing up memory. Whether they call it a memory leak or not is beside the point. Closing and restarting Firefox clears up the problem, at least for me
Same here. When I notice it slowing down, I close and restart it. Then it's happy for a few more days.
I think I haven't seen the problem because I only open Firefox (aka Iceweasel) to view specific sites such as Google Video, YouTube and the finer functions of Gmail and my bank. And when I'm done I close it.

F/OSS does have one major benefit over the proprietary and "Windows" mind-set, agnosticism. Right-click on a link in Konqueror, and one of my options is "Open link in Iceweasel".

There's never a need to ask "X isn't your default browser", because it's entirely configurable without having to make it automatic or whatever. No one is trying to grab your eyes.
tc -

Yes, they are wankers, but they always have been.

Remember the need to toss the Netscape codebase because it was a waste?

Essentially an act of Mozilla turning their backs on users to pursue their own ideas and claim the mantle of Netscape legitimacy.

Good thing that

a) Microsoft took its eye off the prize and let IE get even worse. b) Konqueror!!!!!! and Opera were available.

Now the Firefox folk don't care about the poor dumb users. Again!!! But hey, they can't blame the Netscape legacy. After all, the current code base is the wonderful new stuff they developed to bring us all into Nirvana.
Back to the topic: On this particular PC I'm using at this moment (512MB RAMGentoo + Windowmaker so NO KDE or Gnome!) I never took the effort to create or use a swap partition in first place, untill two months ago or so. That basically means I used this PC without any swap but also without any problem for more than a year (and yes, I did use FF with crappy plugins a lot!) OpenOffice works fine too wile FF runs, no problem at all. Only thing was Azureus, but that's because the number of processes was limited to 100 in /etc/security.conf, and it works fine too at this moment. Azureus, OOo and FF at the same time seems like a lot to me, so if this doesn't need swap, than which house-garden-kitchen apps would?

One time, XMMS was using up all my RAM, and it took like half an hour every time before it halted my computer (hard lock up). I was glad I didn't use swap, because it would only have lasted longer for the memory to fill up (same for Firefox once, but for Firefox it only took three minutes to fill up the 512MB, but normally it is because of the extensions). It also makes finding out where the memory goes to easier, since there's only RAM.

Sometimes I wonder, why do we need swap anyway for machines with >=512MB? Frankly, I don't need it. Using a partition for swap is also a sad thing to do; I prefer to do it the MS-Windows way (honest!) and just use a file, so I don't have to repartition the darn thing if I want to use more or less swap.

But hey, that's just me. Most people are running Gnome instead of Windowmaker, Amarok instead of Audacious, and what have you. More than 1G RAM for Linux seems rather outrageous to me anyway, except for VM's or when doing CAD with 10.000+ parts, but since most of us aren't doing that I don't see the advantage of 6GB virtual RAM?
Well, let's see. I run KDE. I have two Konqueror instances with about 8 tabs open, kmail, konsole. That's usual.

Just for kicks, I opened OpenOffice Write, OO Presenter and Google Earth to see what would happen.

# free total used free shared buffers cached Mem: 514576 508384 6192 0 1976 115784 -/+ buffers/cache: 390624 123952 Swap: 1510068 45588 1464480

So that's 45M of swap being used, but 123M of buffer space _not_ being used. Which tells me that, if I had no swap, the system would still be doing everything I'm asking it to do.

Linux systems do seem sufficiently frugal on resources. I think I'll go find the "swap off" command, and then use the system to see what happens without swap.

In this discussion, what has been the most interesting aspect is finding out that Linux will use a swap file, not just a swap partition. That's great, especially if I choose to install on an existing system where repartitioning isn't a viable option.
One more comment. The last time I rebuilt my wife's windows machine, I created a swap partition on her disk. I was already using Knoppix for partitioning/formatting, since I wanted her XP machine to use FAT so I wouldn't have to worry about accessing the file system from a Linux boot disk at need.

Then NTFS became fully supported, so my reasoning was moot. Oh well.

At least, when I do boot Knoppix, the swap space is available and very nice to have. Much better than reading stuff from the CD all the time.
Quoting:I think I'll go find the "swap off" command


Quick&dirty (I was lazy):

$sudo /sbin/swapoff $(awk '{print $1}' /proc/swaps|grep -v Filename|xargs)

Just found out swap can use files and partitions at the same time in a 'distributed' manner, but the above line handles it all.
Uh, what about swapoff -a ?
Since it's in the /etc/fstab list,

# swapoff -a # swapon -a

I'm even lazier. :^)

Ah, that's what I get for not refreshing the thread (left up last night) before replying.

Post a comment

A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.

Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help

Sign up and post (it is free)  or  Log in and post