Virtual Memory

Virtual Memory

Postby nandersen on 08 Apr 2009 13:53

Guys, I'm running Vista x64 with 4 GB of RAM. From what I read at http://tweakhound.com/vista/tweakguide/index.htm I understand that the best performance should be from having page files at least the size of my physical RAM and that I should always have one of the pagefiles on my boot drive. Simple arithmetic tells me that my total virtual memory size should be 12 GB? Now, suppose that I buy a computer with 12 GB or RAM... the directions from the guide will seem a bit... misguided. Won't they?

Can anybody explain why the pagefiles should be so big? Seems to me like a total waste of disk space. Even if the OS wanted to map every physical memory page to a dedicated spot in the pagefile (for which I can see no reason) it would be possible with e.g. 2x2GB pagefiles rather than 2x4GB pagefiles...?
"They shoot and I run and I spill my drink - all over my uniform..."
My files for S.T.A.L.K.E.R.: http://zhat.dk/stalker/
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24

Re: Virtual Memory

Postby Grump642 on 08 Apr 2009 16:28

Rule of thumb has always been 1-1.5x your physical memory. Thing is, this rule was developed for 32bit OS's. I am not sure it really applies to 64bit. I have 2Gb memory so my pagefile is set to 3Gb. Windows uses the pagefile even when the physical memory is not full. I would set yours to 6Gb and it should be OK.
User avatar
Grump642
Senior Resident
 
Posts: 501
Joined: 20 Dec 2008 05:07
Location: Mississippi, USA

Re: Virtual Memory

Postby EggChen on 08 Apr 2009 21:03

With 8Gb RAM, I decided to turn my pagefile off.... no negative effects yet :-??
User avatar
EggChen
Moderator
 
Posts: 1016
Joined: 13 Sep 2008 00:44
Location: Birmingham, UK

Re: Virtual Memory

Postby nandersen on 08 Apr 2009 21:10

Now, that's my next question: why on earth would an OS want to write anything to a pagefile given an amount of physical memory much greater than the amount of virtual memory that is recommended for such configuration?

Example:
recommended: 2-4 GB of RAM, 1.5 - 4 GB of pagefile.
actual: 12 GB of RAM, 0.5 GB pagefile

So tell me: why is a pagefile needed in such configuration?
"They shoot and I run and I spill my drink - all over my uniform..."
My files for S.T.A.L.K.E.R.: http://zhat.dk/stalker/
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24

Re: Virtual Memory

Postby EggChen on 08 Apr 2009 21:34

I really don't know, the pagefile is one of those things that has never made sense to me.

Even on 32bit XP with 2Gb of RAM, I used to turn it off. Only one program ever complained, Company of Heroes would not even start without a 2Gb pagefile, bet it never used it though!!

I can safely say over the last 3-4 years I have only had a pagefile enabled briefly for CoH (and other times after a reinstall when I forgot to turn it off), all other times the PC has been fine. These days, even with Vista and the excessive prefetching, I have only once seen more than 4Gb in use (that was while playing GTA IV, and using a torrent program at the same time).
User avatar
EggChen
Moderator
 
Posts: 1016
Joined: 13 Sep 2008 00:44
Location: Birmingham, UK

Re: Virtual Memory

Postby NatVac on 08 Apr 2009 21:42

Edit: I've been logged out twice from this site while I looked more closely at the relevant links. Of course, the following does not take into account the rapidity with which you guys respond to each other.

I'm with Grump642: you will likely never need more than 10 GB total active memory at any one time. You probably could get by with quite a bit less.

You are correct in that the pagefile(s) do not need to be that big, nandersen. The pagefile is not mapping RAM, it's supporting virtual memory needs.

Note that if you have one physical drive (with one or more logical-drive partitions), you should still have only one pagefile. And that size-of-RAM rule of thumb was more valid in early Silicolithic times when max addressable RAM was far less than today. But even then, I viewed it like a broken 12-hour analog clock that's right twice a day -- that banal "truth" is not relevant to its intended use.

I question the article's conclusions. It references MS fellow Mark Russinovich (formerly of SysInternals, which seems to be now a part of Microsoft) by linking his Windows Vista Kernel article. Unlike Russinovich articles, the TweakHound article is relatively bereft of reasons supported by measured data.

A couple of the articles cited on the pagefile section (page 6) of that article give you rules of thumb with caveats: "If there is no other information available, the normal recommendation of 1.5 times the amount of RAM in the computer is a good place to start." That's the total pagefile size.

But there is other info available to us these days. Let's consign "rule of thumb" to the wastebin that already contains "wild stab at it", "shooting blindly", and "blue sky". I propose a rule of actual metrics.

Your pagefile is overflow protection for your virtual memory support. It isn't a mirror of your actual RAM*, so doubling it can waste disk space. It should not be tied to the RAM available, rather it should be related to the memory needed by OS and apps.

An application's available memory map is considered to be the size of RAM + pagefile, up to a point.

For 32-bit Windows, applications can use up to 2 GB (32-bit OS application process space default) each. The 32-bit OS needs another 2GB (again, default). Large pagefiles on 32-bit OSes can waste space that will never be used. I think a 3 GB pagefile with 2-4 GB RAM is plenty on 32-bit XP and 32-bit Vista (SP1).

A 64-bit OS can make use of more RAM + pagefile, although practical addressing limitations still exist; it's not a power-of-two thing. I think the new limit is now 128 GB, although OSes might limit that. And I believe that apps themselves still have a 4 GB limit.

My opinion: The pagefile size should be the size of the maximum usage of memory expected in the operation of your PC with its 64-bit OS, less the actual addressable RAM, plus a relatively small safety margin. Consider that it will contain parts of the OS and currently-loaded applications (plural) that are not active, and it can contain parts of the application that has the focus -- parts that are not in use at the moment.

This means that with 64-bit systems, you might be able to get by without any pagefile at all, if you have enough RAM. (Of course, this doesn't account for OS idiosyncrasies. Older Windows OSes are bad about early use of pagefile when lots of RAM is still available.) Edit: Looks like EggChen has just added support to this statement.

On the other hand, more apps these days require much more memory. If you use graphics or sound tools along with game SDKs that need 4 GB each, you'll need more pagefile.

So: You can use the default pagefile while you gather those metrics about how much memory you are using. Then you can decide on optimization if you need it. If 'twere I: I'd create a contiguous block for it not bigger than 6 GB on a single drive on a system with 4 GB RAM. I'm not sure that merely specifying a custom size in the Virtual Memory dialog makes it contiguous, but perhaps defragging will.

I'd say that with larger hard drives, you can allocate a large block of disk space that won't be missed, but it is not practical to allocate space that will never be used.

__________
*Note that this does not account for flush-all-to-disk hibernation; I don't know if that uses a separate file on the drive or not. I would hope so.

"I see your e-peen with my ball-peen, and I call. Oops. Them's the breaks."
NatVac
Resident
 
Posts: 152
Joined: 16 Sep 2008 00:13
Location: Texas

Re: Virtual Memory

Postby EggChen on 08 Apr 2009 22:04

I knew Natvac would have something useful to say!!

As for hibernation, certainly on Vista it uses a different file to the pagefile (hiberfil.sys). It can be deleted, presuming you turn off hibernation, to free up HD space that Vista swallows whole on installation. My hiberfil.sys was 8Gb in size to match the RAM, presumably the logic here is so that everything in RAM can be dumped into this file on hibernate.
User avatar
EggChen
Moderator
 
Posts: 1016
Joined: 13 Sep 2008 00:44
Location: Birmingham, UK

Re: Virtual Memory

Postby Nightwatch on 09 Apr 2009 01:13

I have 4 Gb RAM on my 32 bit Vista (ultimate) system, and although I know that logically the system should see ( and I believe still does) below 4 Gb level on this 32 bit, it reports on System and maintenance that memory is 4Gb. I have two physical hard disks at the moment, and due to the some uneasiness I felt on the operations of the PC while using design nad video software, I increased the paging files on C drive to 400-4900Mb/min-max amounts and on P drive (second physical drive) to 300-3900Mb. So far, it seems (at least it seems so) it's like helping the large memory using programs. I hope there's not a side effect that I haven't heard in respect of using so large files. :mozilla_smile:
NEWSA.SIMBION_TWEAK 3.0
Mod Website= Features, Video, Tips & Download Link: NEWSA.SIMBION_Tweak

Watch the Trailer: http://www.youtube.com/watch?v=1Ajw_f8K ... re=channel
Please Do Not download and install any files from links other than those on the Mod's Website
User avatar
Nightwatch
Site Admin
 
Posts: 2676
Joined: 13 Apr 2007 05:42
Location: London, United Kingdom

Re: Virtual Memory

Postby nandersen on 09 Apr 2009 06:48

NatVac wrote:Your pagefile is overflow protection for your virtual memory support. It isn't a mirror of your actual RAM*, so doubling it can waste disk space. It should not be tied to the RAM available, rather it should be related to the memory needed by OS and apps.

Exactly, that's why I simply don't understand the directions stated in TweakHound's and some other guides. I know my usage and I can safely say that it never even reaches 4 GB.

Another thing I read somewhere is that having more than one RAM module per memory channel should decrease performance. Can anyone confirm this? Or is it something only measured in memory benchmarks and not actual use?
I'm just thinking this: If I know that I'll never use more than 4 gig and just to be safe I make a 2 gig pagefile I could just as well add 2 x 1 gig RAM modules that I have anyway and disable the pagefile?
"They shoot and I run and I spill my drink - all over my uniform..."
My files for S.T.A.L.K.E.R.: http://zhat.dk/stalker/
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24

Re: Virtual Memory

Postby nandersen on 01 May 2009 23:11

Quick update: after adding the 2 Gigs and disabling all the paging files I have experienced exactly 0 problems so far.

The 6 GB setup with no paging file seems to work perfectly stable in my almost vintage C2D system with E6750@3GHz on a GA-P35-DS4 v1.1

The RAM modules that I use: 2 x 2GB + 2 x 1GB - both are matched pair kits of Corsair XMS2 CL4 but they use different heat spreaders.
"They shoot and I run and I spill my drink - all over my uniform..."
My files for S.T.A.L.K.E.R.: http://zhat.dk/stalker/
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24

Re: Virtual Memory

Postby rockingmtranch on 02 May 2009 05:19

No page file. Cool :thumbright:
LINUX! Don't fight it. You will be assimilated!
----------------
Gulf War Vet--2nd Squadron, 2nd ACR, Fort Polk, LA
User avatar
rockingmtranch
Moderator
 
Posts: 1368
Joined: 13 Sep 2008 02:39
Location: White Hills, Arizona

Re: Virtual Memory

Postby nandersen on 02 May 2009 12:41

Funny isn't it? :)

Not sure if you can do without a swap partition in Linux. As far as I know the UNIX systems that I've been working with (Digital UNIX / Tru64 UNIX) require a boot partition regardless of how much physical memory is available or they refuse to install.

I think that a paging file is a legacy feature. Today's modern PCs can have an amount of RAM greater than the capacity of the harddisks that I used in some of my early PCs. Think about it: 12 GB of RAM in a personal computer - just 5 years ago it would have sounded ridiculous.
"They shoot and I run and I spill my drink - all over my uniform..."
My files for S.T.A.L.K.E.R.: http://zhat.dk/stalker/
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24

Re: Virtual Memory

Postby EggChen on 02 May 2009 13:40

My first PC, when I was a wee lad had a 512Mb hard disk......
User avatar
EggChen
Moderator
 
Posts: 1016
Joined: 13 Sep 2008 00:44
Location: Birmingham, UK

Re: Virtual Memory

Postby audioave10 on 22 May 2009 05:00

There are some apps that "need" a pagefile (even if they don't
use it). I think they are rare these days.
Some mobos would not run dual-channel with RAM in all 4 slots.
Hopefully, the newer mobos handle 4 dimms of RAM better now.
Or, you simply could not overclock with all 4 dimms full. I use
2x2gb dimms now and why not? They are so cheap-DDR 2 that is.
"Let the Zone take me if I am"
User avatar
audioave10
Senior Resident
 
Posts: 1154
Joined: 14 Sep 2008 01:30
Location: USA

Re: Virtual Memory

Postby nandersen on 22 May 2009 07:44

audioave10 wrote:There are some apps that "need" a pagefile (even if they don't
use it). I think they are rare these days.
Some mobos would not run dual-channel with RAM in all 4 slots.
Hopefully, the newer mobos handle 4 dimms of RAM better now.
Or, you simply could not overclock with all 4 dimms full. I use
2x2gb dimms now and why not? They are so cheap-DDR 2 that is.

Indeed they are getting cheaper. I just obought a small 2GB kit for my work laptop, it was ridiculously cheap.

I have 2x2GB + 2x1GB so yes, I'm running dual channel with all 4 slots but I'm underclocking my RAM from 800 to 750MHz with an FSB of 375MHz to have nice multipliers of 2 and 8 for RAM and CPU respectively. I also run with 4-4-4-12 timings and 0.1V overvoltage to make these timings stable.
"They shoot and I run and I spill my drink - all over my uniform..."
My files for S.T.A.L.K.E.R.: http://zhat.dk/stalker/
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24


Return to Software Desk

Who is online

Users browsing this forum: No registered users and 23 guests

cron