How much Virtual Memory?

Sorceresss

Witch
Joined
Nov 1, 2005
Messages
532
Location
Montreal (Canada)
I have 1024MB of fast, physical RAM. By default, Win XP (Home) was allocating about 0 to 1500 MB for the VM it managed.

Since I only play on huge maps, I was wondering if it would be better to set my own VM parameters.

But then, I am confused. On this forum, some "experts" recommend allocating a lot of MBs to VM, such as a user-defined Min100/Max2500...while I have read that some other "experts" recommend "forcing Windows" to use all of the faster physical RAM (before accessing VM) by allocating less VM, such as a user-defined Min64/Max1024 (for a system with 1024 of RAM).

To more smoothly run Civ IV on large and huge maps, up to the later stages of the game, which option is the better one : allocating more VM or less VM (supposedly to "force Windows" to use up the faster RAM before) ?

I think this is a very important technical question for everyone who is playing Civ IV on larger maps. THxxx
 
The size of the page file doesn't really influence the windows memory manager as long as you have one. Just make it some fixed size file to minimize fragmentation of your partition and prevent delays for resizing. If you want to be on the save side make it at least 2 GB.
I myself just set it to 4 GB (max size per partition) because I have enough HDD space anyway and now I don't have to care about it anymore.
 
DaEezT said:
The size of the page file doesn't really influence the windows memory manager as long as you have one. Just make it some fixed size file to minimize fragmentation of your partition and prevent delays for resizing.

OK, dank...but you did not directly address the issue mentioned by some "experts" : that Windows would tend to mismanage memory allocation, prematurely resorting to VM while physical RAM would be underutilized (according to them), so having a smaller file for VM would "force Windows" to first exploit the much faster physical RAM to the fullest.

I am inclined to do as you suggest, but I would like to have that issue addressed, because it is associated with a VM management conception which is opposed to yours! THxxx
 
What I've done is set a 4GB fixed permanent swap file.

Windows uses a portion of the hard disk as RAM, constantly swapping data between RAM and hard disk as required. The speed of your hard disk is in the order of 1000 times slower than that of your main memory. Inefficient use of the swap file could considerable slow down your system to a very great extent.

One of the best ways to speed up the swap file usage is to create a permanent swap file. In a permanent swap file, the file used for swapping information has a fixed size and location on your hard disk. When a temporary swap file is used, the location and size of the file is determined by application being used and is not predictable. Also, since a temporary swap file is constantly written to and is not fixed in size, it would be highly fragmented across the partition that holds it.

A better option is to create the swap file on a dedicated partition on your hard disk. By doing this, the swap file will never be fragmented since that partition is only being utilized by the swap file itself.

You can configure the swap file size and location from Control Panel > System > Performance > Virtual Memory. The size of the swap file should be around 2.5 times the amount of RAM on the system.
 
Same here. Mine is set at double my ram. 4Gb swap file.
 
Taliseian said:
What I've done is set a 4GB fixed permanent swap file [...]The size of the swap file should be around 2.5 times the amount of RAM on the system.

THxxx. Your generously long argumentation has convinced me to set up a permanent, fixed size, memory page file.
Since I have 1GB of RAM, you seem to recommend around 2.5GB for its min/max size...but since my HDD has space to spare, can I go up to 4GB as you (and the following poster) have done ?
 
If you have plenty of HD - I'd go for the 4GB. Ideally though you should try and create a separate disk partition (mine is labelled as my 'Z' drive) - and use that for your VM.
 
Exile_Ian said:
If you have plenty of HD - I'd go for the 4GB. Ideally though you should try and create a separate disk partition (mine is labelled as my 'Z' drive) - and use that for your VM.

Ideally you'd place your pagefile on the first partition of a 2nd hard drive. :)
 
However based on my experience and observation using a utility, I don't think Civ4 likes using a windows pagefile very much. My main reason for crashing was linked to running out of memory - with at least 2.5 GB of pagefile unused.

:(
 
I think you should wait till a patch comes out that addresses the memory leak. Supposedly, even on huge maps, Civ4 shouldn't use more than 1GB of memory.
 
It used more than 1GB on my system just fine without crashing...I made a super huge map ONCE....

As far as if lower VM settings forcing windows to use physical memory first... That is not fully true. If Windows wants to put something in VM it'll make the file size bigger and you get a nice delay while this happens. The only exception is that it will tend to put unused or rarely ever used code that is present from boot, into it but that is actually a good thing. (IF you never use it why waste physical memory on it? Mainly relates to OS stuff and some background apps that aren't being currently utilized).

If you have the HDD space to spare then set it at its max. Yes ideal is second Hard drive of relevant speed (If IDE on another cable).
 
phalzyr said:
As far as if lower VM settings forcing windows to use physical memory first... That is not fully true. If Windows wants to put something in VM it'll make the file size bigger and you get a nice delay while this happens. [...] If you have the HDD space to spare then set it at its max

THxxx. For now, I set the min. & max. sizes of the VM page file at 2500MB. I do not have a second HDD yet.

You might like to read this article on "Virtual Memory in Windows XP" (2005) : http://aumha.org/win5/a/xpvm.php
 
I've got mine set for 3gigs with 1gig of chip ram. I think I read somewhere once that 2.5 times chip ram is optimum.

Whatever you set it on, like I see some have mentioned here, make the min and max the same number and DO NOT LET WINDOWS MANAGE THE PAGEFILE. That is, unless you enjoy a heavily fragmented harddrive.
 
The 2.5x rule hasn't really been valid for the last couple of years. What you do is you try to think how much memory you have ever used when it was maxed out. I have 1gb, and one time with lots of programs running, I was at 2.5 total. So i set my swap to 2.5Gb which means I have 1Gb more than I ever used as a safety margin. That is plenty. If your machine has 2Gb physical ram, you can probably set your swap to 1.5Gb or lower and be safe. If you need a 4Gb swap file, what you really need is more physical ram.
 
The perfect size for a swapfile is 0 (zero).

The moment you start using the swapfile in your desktop computer for long time running applications you are in trouble and should get more RAM.

I can give you three reasons for my statement:

1) Normal desktop performance of a computer suffers dramatically when using a swapfile intensively.
2) The main purpose of a swap file is to store rarely accessed data, not running applications that require constant access to the swap.
3) Intensive use of the swapfile because of memory shortage decreases the lifespan of your hard disks.

The academical rule of thumb to calculate swapfile size for servers is:

swap size = RAM size x 1.5


For desktops not running any kind server applications, half the size of the RAM is more than enough. Your computer becomes unproductive before you can fill half the size of your RAM in a swapfile ;)

There is an exception though : if you have 512MB or less, don't use a swapfile smaller than your memory size. If you have 1GB RAM, a 512MB swap for a desktop is waaay more than enough. You computer will appear frozen before you fill up 512MB of swap. That is because disk access speeds are several orders of magnitude lower than memory speeds.

An interactive application should not need to use a swapfile, and doesn't like to.
 
limpkit?

Ok...when I install 4Gb of ram...what should my swapfile be then? ZERO? 1GB?

I am confused now.
 
Old Dood said:
limpkit?

Ok...when I install 4Gb of ram...what should my swapfile be then? ZERO? 1GB?

I am confused now.

:D sorry if I was confusing.

You *could* just disable your swapfile with 4GB RAM. But like I said above, if you have 1GB RAM (or more as I should have add) just set the swap to something small like 512MB. That way if you ever manage to fill your 4GB RAM, your computer will still have a little room using the small swapfile. That way, you will notice the loss of responsiveness of your system and will be able to take preventive action, instead of just having the computer hang without memory available.

As processor and disk speeds and capacities increase over time, you may want to increase that swapfile later, maybe to 1GB... a year from now or something like that.

It all depends on your computing habits too. If you are the kind of person that usually has 2.351.798 different applications running simultaneously you obviously need a much bigger swapfile, because Windows moves open applications that have not been used for a while to the swapfile to increase memory space for the applications you are actually running.

I don't need that much swap because all the applications I have open at any given time usually total 3 or 4. I have this bad habit of closing apps I'm not using, except for browser windows ;-) Acting this way keeps the computer responsive most of the time, at the cost of the few seconds it takes to open any given app.

Now I'm not sure if this is any less confusing, so please let me know if I got the message across.

And I can't stress this enough, this is just my informed opinion, other informed people may have different ones, and none of us is right/wrong, just different. Feel free to adopt the strategy you feel is right for you :)
 
Back
Top Bottom