SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The idea of the recommended swap size being about 2 - 2.5 times the RAM is not appropriate unless you're using a very old computer with not very much RAM. Also, that recommendation is very Windows-ish...unless you're doing, say, heavy video or audio editing, it's just a waste to set the swap that big in Linux. If you did...check the percentage of the swap file being used. You might be surprised. In my case (1024 MB RAM), I have yet to see swap utilization which exceeds 0.0%.
Distribution: Mint 17.2 ,OpenSuse, Kali and Pepermint OS 6
Posts: 276
Rep:
I agree with nvn if you have 1024 ram you need very minimal swap ie: none or at the most 256. I have 1024 RAM and I have my Swap set at 128MB and I have never once touched my swap space.
512MB RAM 256 MB swap here , using at most 5% of the swap space.
However, if you do programming using dynamic memory allocations and tend to forget freeing stuff (like I do ) you really wish you had much more swap space
In the other side, using memory profilers save the day
I think one needs to be cautious in just saying you don't need swap anymore. At the time of Slack 8, Linus T himself was still saying you needed 2x Ram. The kernel underwent some changes that may have changed that need, where less was needed. In reading some of the notes on 2.6, there is discussion of what is in RAM during a crash being saved to swap. In that case swap would need to be at least as big as RAM.
Noticed this discussion and im wondering, for my instal of slack 9.1 on my computer with 786MB of DDR how big i should actually make my swap, i was gonna make a partition for it but i dont know if i want to if it'll go to waste (i hate being wasteful with space and not planning properly) So if i were to just not make a partition would it make any sort of difference? i doubt i'd notice that much because i dont plan on using slack as a primary OS, Im still in highschool and of course my web design teacher cant make a page work in anything but IE.
Anyways if i just make one partition for slack and just keep the swap with the root and home and everything in a single partition would that be ok? or is that just a no no?
Hmmm...I use 1024MB of RAM, and have no real need for swap. I have to agree with nvn here.
Now if you have 512 or less, a little swap partition wouldn't hurt...say 256-512MB???
My 2cents...
I only have 192 megs of ram, after trying bloated redhat and seting my swap at 400mb and still using very little swap, i installed slackware with only 100mb swap, and I'm keeping the WM light (fluxbox).
I have yet to see over 1% being used, anyways, I can always back up and resize my "/home" partition if I ever think i need more swap; for say, apache or something. but I guess thats the benefit of using many partitions on an install (although realistically I only have /, /home, and swap)
Did a google search on the subject and came up with an old but very interesting page. It goes into the history of the 2x rule.
Quote:
That RAM to swap ratio thing, was an old Berkley-ism.
The older Berkley-based kernels (like SunOS 4.x and
before) would actually load the application into
memory and swap. The 2X+10% rule was to ensure that
the kernel had enough room to work with.
and although it doesn't mention Linux, I think the following applies:
Quote:
The total amount of virtual memory (physical memory
and swap) required for a machine is dependent upon
the cumulative memory requirements of all processes.
When you run out of virtual memory, new processes can
not be started and running processes that execute
'mallocs' will fail.
Obviously, it is necessary to size the machine with
sufficient virtual memory capacity to avoid this
condition; however, the ratio of physical memory to
swap space required for reasonable performance is
completely dependent upon the characteristics of the
applications. If the processes use large amounts of
memory that is 'active' (i.e. frequently updated or
referenced), then a high ratio of physical memory to
swap will be required to deliver consistent
performance. If, however, the applications use large
amounts of memory, most of which is inactive,
then reasonable performance can be achieved with a
smaller physical memory to swap ratio. 'Rule of
thumb' guidelines for memory/swap sizing are useless
because the system requirements are completely
application dependent.
A bit technical, but an interesting read none the less.
Personally I have a half GB of RAM and a swap partition of the same size even though the only times it has come close to being full was when I ran a program that probably had a memory leak, and when I wrote a perl script that deliberately tried to fill it.
I read an account of a gentoo user's attempt to install kde and how he succeeded when he used 400MB swap to supplement his 64 MB of RAM, so there are circumstances when big swap is useful, though I forget what his original swap was. If he was using the 2x rule then I guess it would have been 128MB. Perhaps he could have been successful with something less than 400MB but more than 128MB.
The real question is 'how much memory do you need, preferably allowing for a margin of safety?'. Ultimately that can only be answered by experience, since people have different usage patterns. There's no 'one size fits all' rule. That said, if you have a GB of RAM you probably don't need a 2GB swap.
Well my question is, how does windows actually determine its swap size apart from nessicity? it's worked for me so far, before now i never had to worry so im not gonna. occasionally when im not on my awe inspiring computer i've gotten that message about windows increasing the paging file size, if thats the only time it makes changes then how does it figure the page size? does windows use x*2=10%?
Personally, my experience has been that if you've got 256Mg or more of RAM, it's unlikely that you would be using swap to any significant degree. As others have stated, the "twice RAM" guideline is a legacy of the days when having (for example) 64Mg of RAM was considered a totally bitchin rig. Obviously it doesn't hurt to create a big swap space, but unless your usage actually warrants it, you probably are just wasting disk space.
My recommendation would be to allocate a max of 256Mg for swap, regardless of how much memory you have. -- J.W.
Hi all - I have a box with 4 GB of RAM. I understand there is a limitation to the size of a swap partition on RedHat 8.0 of 2 GB, but it appears as though I cannot add more swap partitions to create more than 4 GB of swap. I know this may seem insane per your discussion, but the apps that my co-worker ASIC engineers are running on this box actually have failed with 4 GB of ram and 2 gb of swap, claiming a lack of memory (this could be the tool version's fault, not the OS)
I added a 2 GB swap partition and that bumped up the total swap space to 4 GB, but when I add another 2 GB swap partition, it bumps down to 2 GB of total swap - why?
I might be missing something obvious, so I thought I would ask. Any info is greatly appreciated.
256MB Ram and 128MB swap here - never had a problem while using this laptop for coding (C and Websites) or usual office stuff and a little GIMP.
As for your problem, discostu. I couldn't really follow how much swap you know actually have but you do know that 4GB Ram is the upper limit for 32bit processors unless you enabled PAE in your kernel. Look in the kernel config in the "Processor features" under "High memory support" whether your kernel can handle up to 960MB, 4GB or 64GB of RAM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.