8

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.

3
  • 4
    Builds are IO intensive, and thus Windows is keeping a large file system cache to improve performance. Unfortunately, build tools also use a lot of memory too and usually in large spikes, which is probably causing the swamping. As this is competing against the system cache. The best solution might be to add more memory.
    – tgiphil
    Jan 17, 2011 at 18:42
  • @tgiphil, It's understandable that a lot of memory is used when checking out or making the build. However, it's still being used and still causes thrashing much later when I'm just working in a small area. Unfortunately IT won't give me any more memory.
    – Jay Conrod
    Jan 17, 2011 at 19:37
  • I think Windows 7 is already optimizing your performance with caching. So to increase available memory and to reduce swap, close any unnecessary applications. You can get a good chunk of memory back by closing Outlook and Firefox, for example. If using Visual Studio and only need to compile, try a command line build instead. I hope this helps. BTW. With memory so low (6Gb under $100), it’s a excellent productivity investment.
    – tgiphil
    Jan 18, 2011 at 3:28

2 Answers 2

4

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.

7
  • The +1 is for "Disable Superfetch".
    – user3463
    Jan 17, 2011 at 22:00
  • No down grade, but Superfetch is most likely increasing his performance – not decreasing it - since build executables are generally executed frequently and will benefit from being cached. As for video card affecting available memory, it is not applicable on Windows 7 64bit with only 4Gb. The video card would be mapped above 4Gb, in this case.
    – tgiphil
    Jan 18, 2011 at 3:19
  • @tgiphil: From the above-cited Microsoft article : "a video card that has 256 MB of on-board memory, that memory must be mapped within the first 4 GB of address space".
    – harrymc
    Jan 18, 2011 at 5:55
  • At my organization, we also have tons of small files and a huge NTFS metafile in RAM. From what I can tell, Windows doesn't cache the Metafile like everything else and never really releases it from RAM. The computer will go up to 100% memory usage and then all your applications start crashing due to lack of memory. Of course this isn't Windows 7, it's Windows Server 2008 R2.
    – Phil
    Aug 17, 2011 at 14:12
  • Also the "Increase FileSystem Memory Cache" link advises things that don't actually work. See tweakhound.com/blog/?p=1164
    – Phil
    Aug 17, 2011 at 14:24
0

Windows 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .