My work computer (Windows 7 64-bit) spends a lot of time swapping memory when I switch between programs. This surprises me since I have 4 GB of RAM, and the programs I use aren't particularly RAM hungry (Outlook, Emacs, p4win, Firefox, various build tools). I downloaded RAMMap, and it shows over a gigabyte of memory used by "Metafile".
From the Sysinternals blog:
Metafile is part of the system cache and consists of NTFS metadata. NTFS metadata includes the MFT as well as the other various NTFS metadata files. ... In the MFT each file attribute record takes 1k and each file has at least one attribute record. Add to this the other NTFS metadata files and you can see why the Metafile category can grow quite large on servers with lots of files.
So I understand what the "Metafile" data is... I work on large builds comprising hundreds of thousands of files (none are that big, but they add up to several gigabytes). My question is how can I reduce the amount of memory used by "Metafile"? I'm not actively using all those files at once, so why does Windows need to keep info in RAM? Restarting my machine every time I sync a new build is really annoying.
32 Answers
I believe that the system cache releases its memory when required, but glitches can happen. Below are listed some possibilities.
Your 64-bits system allocates the video memory in the first 4GB of memory. So if your video card has lots of memory, that memory is lost, as described in :
The usable memory may be less than the installed memory on Windows 7-based computers
You may examine the memory usage on the computer by opening the Device Manager and under the View menu, choose "Resources by connection". Expand the Memory node and see if you can figure out what, if anything, is occupying the memory. In some cases, memory can be increased by disabling unused devices such as firewire.
You can also try and do the exact opposite of what is described in this article :
Increase The FileSystem Memory Cache Size In Windows 7
You can also try to Disable Windows 7 SuperFetch.
If nothing helps, it would be useful for you to post a screenshot of the Task Manager tab named Performance.
7Windows Server 2008 R2 experiences exactly the same metafile "cache" problem, that too much metafile info is kept in active memory, so the cache functions do not have permission to allow this memory to be released when there is memory pressure.
I've written a powershell script on the serverfault.com page Windows Server 2008 R2 metafile RAM usage that sets the maximum metafile active memory to something reasonable. The rest is moved to standby memory, and the normal cache functions are then able to priorities things appropriately. Windows 7 x64 and Server 2008 R2 x64 both have default maximum active memory limits for metafile data of 1TB. Yes TB, not GB.
Work now runs that script at all our sites on our servers that organise the site's backups, which deal with millions of files during its backup cycle every day. These backup servers also run a memory heavy java program (VMware vSphere), 2 SQL servers, and WSUS with its own SQL server. With the backup software first reading the metadata (name, size, date modified, permissions, attributes, etc) to determine the list of files it will backup in that pass it VERY quickly fills up the metafile cache. Even doing all that they cruise along nicely with only 4GB of RAM.