0

I'd like to decrease my cache size, because I have a slow disk and run a swap-less system (it's pretty snappy that way). I have x86 Vista and 3 GB RAM. The problem is that Windows eats about 1 GB RAM for disk cache (shown in Task Manager under Physical Memory -> Cached), that leaves only 2 GB for applications. A very annoying pop-up pops up every time when Windows thinks it's low on memory and of course apps crash when the memory is used. But there's still 1 GB sitting in the cache!

I've tried AnalogX Cache Booster, but it didn't do anything, memory usage stays the same, warning pop ups are at the same levels.

Axarydax
  • 1,227
  • 4
  • 21
  • 37
  • 3
    won't decreasing cache also decrease snappiness? – stijn Oct 08 '10 at 12:07
  • I define snappiness as responsiveness between switching applications. As swap file is already off, all of them are in RAM - lightning fast switch. I'm willing to sacrifice disk I/O speed for it – Axarydax Oct 08 '10 at 12:45
  • 2
    @Axarydax; That's not how it works, disk cache can be dropped straight away, you're not actually losing any RAM at all. If you're getting low RAM warnings, it's not because of that - I ran Vista on 2GB of RAM, and never saw a low RAM warning. – Phoshi Oct 08 '10 at 17:50
  • @Phoshi - it was because you had swapfile on. – Axarydax Oct 08 '10 at 19:08
  • 1
    @Axarydax; Perhaps you should turn yours on, then. You can't have both an entirely RAM based system, and run more applications than you have the resources to maintain. – Phoshi Oct 08 '10 at 22:28
  • I'm starting to suspect Windows Vista's Superfetch is the culprit here... – Axarydax Oct 09 '10 at 09:46
  • 1
    "*that leaves only 2 GB for applications*". This is not true. The memory used for a disk cache is available for applications. This question is based on the misconception that the pop up is warning you that you are running out of RAM and thus more free RAM will help. But read it closely -- it's not about RAM at all. – David Schwartz Aug 07 '17 at 17:45

3 Answers3

6

I have ... a swap-less system

I used to think the same way. I've since learned that, in MS Windows, this is a bad idea and can actually hurt performance.

Windows thinks of RAM more as an optimization layer over the hard disk. It doesn't want to wait until you have to swap RAM out before paging/swapping it to disk. Instead, Windows wants anything you put in RAM to already be paged/swapped.

This way, when Windows needs the RAM for something else, it can just use it. This strategy works because it places the (slow) disk writes at the points when your computer is less stressed, at the expense of slightly slower application loads and maybe paging some things it doesn't need to, rather than at the point when your computer is already more stressed and running low on RAM.

Of course, by removing the paging file completely you might tend to think that you get the best of both worlds. However, there's loads of code in Windows that is optimized assuming the performance model I just described. You're really better off making sure you have at least as much swap space as you do RAM.

Joel Coehoorn
  • 28,098
  • 14
  • 88
  • 133
  • The system is a lot less responsive when using swap file. I have a good laptop, but with hellishly hard disk, and when I have multiple instances of Visual Studio, browser with lot of tabs, VM or two, database management studio, things tend to swap a lot. And switching apps becomes a long wait. Without swap files, everything's instant. That's a win for me. – Axarydax Oct 08 '10 at 19:03
  • Now you discover a limitation of a swap-less system. If you have multiple Visual Studio instances and several browser tabs, you _**need**_ more RAM than you have. – Joel Coehoorn Oct 08 '10 at 19:26
  • that's why I'm getting an 8 GB RAM system in a while. I just need to survive on this machine for a while :-) – Axarydax Oct 09 '10 at 09:37
  • Unfortunately this answer is not very useful anymore at this date (if you're on tablet well maybe you want a small one but it'll be bad for the ssd), I have 16GB of RAM for a very low price. Have been using the PC for a year and not a single time have I ran out. There is just no reason to bottleneck your hard disk with a pagefile anymore. – CausingUnderflowsEverywhere Jul 20 '16 at 11:28
2

By default, Vista (and later) x86 will only allow 2 GB of virtual memory for each process. If one application needs more, for example 3GB, you can increase this by :

bcdedit /set IncreaseUserVa 3072

However this will only work for executables that were linked with the "large address aware" flag. Processes running other exe's will still be limited to 2 GB.

Real RAM is allocated as required for both applications and the system.

As this doesn't seem to be your problem, then to optimize the usage of memory one can first Disable SuperFetch on Windows Vista :

The SuperFetch service in Windows Vista preloads your system’s memory with the applications that you use most often. This makes launching of those applications much faster, but it might be an unwanted behavior for system tweakers or gamers.

Secondly, to control the disk cache size, AnalogX CacheBooster is a free tool that is said able to tweak the hard disk cache (never tried it myself), but I'm not sure that it will help, in view of the info below.

As described in Windows Vista Memory Tweak Guide, the disk cache parameters reside in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\Memory Management

Some important parameters are :

DisablePagingExecutive controls how inactive kernel-mode drivers and system code can be released from RAM and paged to the Page File. Unfortunately, you don't have a page file so system code never gets swapped out.

LargeSystemCache controls the size of the file system cache as follows:

  • 0 (Default) a standard sized file system cache is allocated (less than 10MB RAM)
  • 1 enables the use of a large file system cache (up to total RAM amount minus 4MB!)

If this value is zero in your case, then the disk cache is already as small as it can get. If the performance you get is not satisfying, then you must invest in hardware : either more RAM or a faster hard disk. Increasing RAM from 3GB to 4GB will only get you an increase of (1GB - video-memory), unless you also pass to a 64-bit version of Windows.

Jamie Hanrahan
  • 23,140
  • 6
  • 63
  • 92
harrymc
  • 455,459
  • 31
  • 526
  • 924
  • The IncreaseUserVa switch controls the virtual memory space allocated to each program. It does not have any effect on the way that the physical memory within the system is handled. That is, this switch controls the amount of memory that individual programs can make use of, not the amount of memory that the system can use. – Axarydax Oct 08 '10 at 19:05
  • I believe you are wrong : See my edit. – harrymc Oct 08 '10 at 20:47
  • I still think that Virtual Memory (2 GB or 4 GB) is for each application, not for all of them total. One program can have 1 GB, second program can have another GB, third another GB. I don't need more than 2 GB for each program, I need Windows to drop its cache to allow me to use all of my 3 GB for programs, combined. – Axarydax Oct 09 '10 at 09:36
  • I think I misunderstood you, so I rewrote my answer. – harrymc Oct 09 '10 at 12:18
  • Re the advice to "disable SuperFetch": SuperFetch does not in any way add to the amount of RAM reported as "Cached"! SuperFetch uses RAM that's already been put on the Standby page list (after being removed from processes). The SPL is already counted as part of "Cached". After using that RAM to cache file contents, SF leaves it on the Standby page list, _so it's still counted as part of "Cached"!_ So all else being equal, disabling SuperFetch will not change the amount of RAM reported as "Cached"! That RAM is just used for a different sort of cache (a file cache rather than a page cache). – Jamie Hanrahan Dec 22 '18 at 05:24
0

A very annoying pop-up pops up every time when Windows thinks it's low on memory and of course apps crash when the memory is used.

This popup has nothing to do with RAM, and nothing to do with Windows' cache. It means you are running out of commit limit. This is a limit on how much private virtual address space your processes can allocate.

There are three ways to increase your commit limit: 1) run less stuff or smaller stuff at one time; 2) increase RAM; 3) increase your pagefile size. This is because the commit limit is simply the size of RAM plus the current size of the pagefile.

If you would enable your pagefile the way the OS designers intended you wouldn't be seeing these messages and your programs wouldn't be crashing.

And despite what CausingUnderflowsEverywhere said in their comment, sometimes you need a pagefile to allow programs to allocate the virtual memory they need, even though there is plenty of available RAM, and even though the pagefile might not actually be used. For why, see my answers here and enter link description here here.

n.b.: Most of the "cached" RAM reported by Task Manager is still "Available"; the SuperFetch cache does not really "use" RAM. The "cache" is not what's causing your problem. Lack of a pagefile is.

Jamie Hanrahan
  • 23,140
  • 6
  • 63
  • 92