Skip to main content
GameDev.net gamedev.net
🔒 Locked

Increasing Vista's RAM Usage

Started by DrGUI Feb 22, 2009 at 5:10 AM 12 replies 5.1k views
Original Post
DrGUI
DrGUI
Hey guys, I read something recently on how Vista looks at your RAM as a cache, rather than a resource. And of course, having an expensive cache, you want to utilise it fully, to avoid swap file usage. Now with it being winter, I leave my computer on (doing distributed computing as a space heater) for long periods of time. I have 2GB RAM, and with everything I'm doing on the computer, I'm often running at 2.2-2.4GB commit memory. However much commit memory I'm using, Vista seems to maintain the amount of physical memory being used to between 1GB and 1.2GB How can I make Vista cache more of my commit memory into the physical memory? Cheers
Sc4Freak
Sc4Freak
Add more RAM. From my observations, Vista seems to like keeping physical RAM usage at ~50%.

The reason for this is that Vista does a lot of intelligent caching in the background - any file/network reads, for example, are cached in memory in case it is accessed again. The theory is that if an application is not using (or doesn't need) the physical memory, it's better to page that memory out and use the RAM to cache stuff, which would be better for performance overall.

I don't know of any setting to change this behaviour (short of finding a way to disable the page file altogether, but you should never do this).
_the_phantom_
_the_phantom_
Quote:
Original post by DrGUI
However much commit memory I'm using, Vista seems to maintain the amount of physical memory being used to between 1GB and 1.2GB How can I make Vista cache more of my commit memory into the physical memory?


What are you looking at to get these figures?

A quick look at the performance tab in task manager for me, in Vista x64, shows that from my physical memory I have;

total : 4093
cached : 3024
free : 45

This is in the box BELOW the memory usage bar graph... thing... and I wouldn't be surprised if yours was something like that as well (scaled for 2gig of course).

MindWipe
MindWipe
I'd like to do this too. I got 8gb but never is more than 4gb in use. No use in having a lot of memory if it's not getting used.

/MindWipe
"To some its a six-pack, to me it's a support group."
DrGUI
DrGUI
@SC4Freak: Thanks for your response. I don't think I need more RAM, but would like more to be kept in RAM to reduce swapfile usage when half the RAM is empty!

@phantom, I use SysInternals' Process Explorer and RivaTuner's monitoring (for overclocking gfx card).

Total is 2GB,
System cache is 1008MB,
Free is 866MB,
Commit charge is 2.3GB

at this moment in time.


@MindWipe, perhaps you _could_ disable your pagefile. Tom's Hardware did some tests with that - if you can be sure that you won't run out of memory then you can get away with no pagefile and everything will be kept in RAM. They didn't advise it with 4GB, but it was fine with either 8GB or 16GB. Unfortunately I can't find the article with their search.
Instigator
Instigator
Quote:
@MindWipe, perhaps you _could_ disable your pagefile. Tom's Hardware did some tests with that - if you can be sure that you won't run out of memory then you can get away with no pagefile and everything will be kept in RAM. They didn't advise it with 4GB, but it was fine with either 8GB or 16GB. Unfortunately I can't find the article with their search.

That article is the 1st thing that came to my mind when I started reading this thread.
Vista Workshop: More RAM, More Speed : Windows Vista With 8 GB
zedz
zedz
ms os's arent to memory smart, if the memorys there it should be used right?

with winxp try
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\DisablePagingExecutive = 1

(perhaps a similar key in vista)
MindWipe
MindWipe
Quote:
Original post by Instigator
Quote:
@MindWipe, perhaps you _could_ disable your pagefile. Tom's Hardware did some tests with that - if you can be sure that you won't run out of memory then you can get away with no pagefile and everything will be kept in RAM. They didn't advise it with 4GB, but it was fine with either 8GB or 16GB. Unfortunately I can't find the article with their search.

That article is the 1st thing that came to my mind when I started reading this thread.
Vista Workshop: More RAM, More Speed : Windows Vista With 8 GB


Ah, awesome! Thanks guys!

/MindWipe
"To some its a six-pack, to me it's a support group."
DrGUI
DrGUI
Quote:
Original post by zedz
ms os's arent to memory smart, if the memorys there it should be used right?

with winxp try
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\DisablePagingExecutive = 1

(perhaps a similar key in vista)


I found out what that key does: Mem tweaks

It depends whether forcing system memory to stay in RAM would actually increase the proportion of the physical RAM used or just result in more program memory being paged out...I'll give it a try when I next reboot though.
Sc4Freak
Sc4Freak
Quote:
Original post by DrGUI
@SC4Freak: Thanks for your response. I don't think I need more RAM, but would like more to be kept in RAM to reduce swapfile usage when half the RAM is empty!

That's the point - it's not empty. If you check Task Manager, you will have almost no "Free" memory. The "Physical Memory Usage History" graph tells you how much memory is being used up by applications and the kernel, but not how much is being used by Vista's caching.

Consider the following: I've got some leaky gadgets installed on my Vista Sidebar, and my uptime so far has been a couple of weeks. The Sidebar currently has a commit size of ~586MB. Even though I have 4GB of RAM and 55% physical memory usage, only ~100MB of that 586MB is actually resident in physical RAM; the rest is paged out since the sidebar isn't actually using any of that data.

If that 486MB was all kept resident in RAM, that would be a tremendous waste of memory since nothing would be using any of that data. Instead, Vista paged it out to hard disk and instead put that 486MB towards caching instead. Task Manager reports 2278MB of "Cached" memory, and only 54MB "Free".

With that 486MB put towards caching, it can be used to speed up network transfers, or filesystem read performance. This is why Vista tends to agressively page out unused memory - because Vista has the ability to make better use of that memory.

People often don't give Vista enough credit when it comes to memory management. By default it's already very smart - in general it knows how to manage your memory far better than you do. If you somehow force Vista to disable its caching mechanisms and instead keep useless application data in memory, you'd very likely see a marked decrease in general performance of your machine.
DrGUI
DrGUI
Quote:
Original post by Sc4Freak
Quote:
Original post by DrGUI
@SC4Freak: Thanks for your response. I don't think I need more RAM, but would like more to be kept in RAM to reduce swapfile usage when half the RAM is empty!

That's the point - it's not empty. If you check Task Manager, you will have almost no "Free" memory. The "Physical Memory Usage History" graph tells you how much memory is being used up by applications and the kernel, but not how much is being used by Vista's caching.


On the contrary, there appears to be 800-900MB 'available physical memory' shown in process explorer, out of 2GB RAM. Although I do notice that not all RAM is accounted for (total - system cache - available) ~ 300MB, perhaps this is the cache?

But still there is some swapping (page faults are around 30,000 just now), so it seems that keeping that 800-900MB 'available' RAM filled would be beneficial. Unless you're saying it's already filled, invisibly, apart from the 'system cache' and the unaccounted-for 300MB?

Cheers

p.s. I'd agree that Vista got a lot of stick, probably from people just picking up on what the enthusiasts were saying about it. Granted, I joined after SP1, once all the gfx card drivers were sorted, but I've been really happy with it :)
Phantom Sage
Phantom Sage
On my crappy 2GB Vista laptop I get these results:

Task manager
Total: 2037
Cached: 1197
Free: 41

Proc Explorer
Total: 2037
Available: 1043
System Cache: 1120

That tells me that Process Explorer has no idea about SuperFetch and just assumes that the cached memory is free.

I also noticed the GetMemoryStatusEx function doing the same thing last night, it told me I had 5 GB free (physical memory) on my desktop machine even though there was like 7 MB reported by Task Manager.
DrGUI
DrGUI
Hey thanks for that info.

I just checked:

Process Explorer:
Total: 2GB
Available: 800MB
Sys cache: 730MB

Task Manager:
Total: 2GB
Cached: 900MB
Free: 4MB

Cheers, Vista _is_ probably using memory optimally in fact. It's just keepin it on the low...
Codeka
Codeka
Quote:
Original post by DrGUI
Cheers, Vista _is_ probably using memory optimally in fact. It's just keepin it on the low...


If you click the "Resource Monitor" button on the "Performance" tab of task manager, it'll show you, next to "Memory", the number of hard page faults per second that is occuring. If that number remains low (mine stays on 0 for pretty much of the time) then it's using memory pretty optimally.

If it's > 0, then that's a sign that you probably need to install more memory.

In fact, it's probably good that not all committed memory is actually resident in physical memory. Most applications will allocate memory that they only use occasionally. For example, they might have a dialog box loaded in memory that is only used if you use a certain feature. If you don't happen to be using that feature right now, then it's better to write that page to the pagefile and free up that page of physical memory for something else. If it takes 20ms to load that page back into physical memory when you actually do click the menu item to activate the feature, then you're hardly going to notice.

Also, just an FYI, a hard page fault does not not always mean "loading a page from the pagefile", but it's a good general metric.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.