Windows では、8 GB の RAM が数 MB のように感じられるのはなぜでしょうか?

Windows では、8 GB の RAM が数 MB のように感じられるのはなぜでしょうか?

私は 4 コアの Intel i7 と 8 GB の RAM を搭載した Windows 7 x64 を使用していますが、最近、コンピューターの「RAM」がハード ドライブ上にのみ配置されているように感じます。

タスク マネージャーに表示される内容は次のとおりです。

タスクマネージャーのスクリーンショット

リスト内のプロセスが使用するメモリの合計量は、約 1 GB です。そして、ここ数日、私のコンピューターで発生しているのは、1 つのプログラム (Cataloger.exe) が大量のファイル (それぞれ約 5 ~ 10 MB) を継続的に処理し、カタログ作成のために繰り返しファイルを開いて読み取っていることです。しかし、メモリ内ではそれほど大きくならず、100 MB 程度の大きさのままです。ただし、たとえば 30 分間に処理されるデータの量は、ギガバイト単位で測定できます。

そこで、Windows のファイル キャッシュが関係しているのではないかと推測しました。このトピックについて少し調べた後、コンピューターの RAM に関する詳細情報を表示する RamMap というプログラムを見つけました。スクリーンショットを以下に示します。

RamMap スクリーンショット

So to me it looks like Windows keeps in RAM huge amounts of data that is no longer needed, redirecting any RAM allocation requests to the pagefile on the hard drive. Even when I close Cataloger.exe, the RamMap reports the size of the mapped file as about the same for a long time on. And it's not just this particular program. Earlier I noticed that similar slowdown occurred after some massive file operations with other programs. So it's really not an exceptional behavior of Cataloger.exe and the problem manifested itself many times in the past.

Whatever it is, it slows down the computer by like 50 times. Opening a new tab in Chrome takes 20-30 seconds, opening a new program can take up to a minute. Due to the slowdown, some programs even crash.

So what do you think, is the problem hiding in file caching or somewhere else? How do I solve it?

答え1

This is just business as usual, and everything is working correctly. Windows isn't holding cached files in memory over other data - Cached files means that at one point, Windows had to load them into memory or read them off the disk, and something higher-priority has not come along since that time. Just as soon as you resume using the computer and programs request memory, Windows will happily remove the cached files to make room.

If you look at RAMMap, you'll notice that most of those cached files are allocated under "Standby" - that means that it's being held in memory because Windows needed it in the past, might need it again, and will quite happily discard it if something else actually needs the space.

Basically what you're seeing here is your program requests a large data file to be loaded, so Windows loads it into memory. Managing memory is a very complex process, and what Windows is doing under the covers here is making a judgement call: It looks at the current processes, and sees that Chrome is taking up, say 5GB of memory (lots of tabs!), but that most of that memory hasn't been touched in the last hour. At this point, it has a choice: It can leave Chrome in memory, and not cache the files. This means that the Cataloger process could take hours instead of minutes to process a file, especially if it is jumping around in the file a lot; or, it can page out the chrome tabs and load the Cataloger file into memory, and finish that process quickly.

さて、Windows が Chrome をメモリにページングし直す必要があるときに苦痛を感じるでしょうが、Windows はユーザーが要求するまで (つまり、Chrome をフォアグラウンドに戻してページ アウトされたタブを選択するまで) それを行いません。最終的にユーザーが評価する必要があるのは、その苦痛が Cataloger タスクがメモリを待機しなければならない苦痛より大きいか小さいかということです。プログラムをサービスとして実行し、Windows に応答性を最適化するように指示するか、プロセスの優先度を下げることを試してもいいですが、Cataloger プロセスが可能な限り速く終了することを望むのは間違いありません。ディスク I/O が最大限に使用されている間、システム全体が非常に遅くなります。ディスク I/O を必要とするものはすべてキューに入れられます (Web ブラウジングも - キャッシュも使用します)。プログラムの起動は遅く、新しいタブの起動は速いですが、実際にそれらを使用して何かを行うと遅くなります。


プログラムがファイルを次から次へと読み込んで、その後は再度アクセスしない場合は、Windows がファイルをキャッシュする必要がないことに同意します。ここでの問題は、Windows がそれを認識していないことです。誰もキャッシュする必要がないことを Windows に伝えていないからです。

Cataloger プログラムのソース コードにアクセスできる場合 (または変更を要求できる場合)、 でファイルを開くように構成できます。FILE_FLAG_NO_BUFFERINGこれにより、Windows は、この方法でプログラムによって開かれたファイルのディスク キャッシュをスキップします。

それが選択肢にない場合は、カタログ作成プロセスがもっているシステムで実行したい場合は、使用されていない予備のコンピュータがあるかどうかを調べ、これらのファイルのカタログ作成専用マシンとして設定できるかどうかを確認します。まだない場合は、RAM を増やすことも別の選択肢です。メモリの価格は現在かなり安くなっており、開発者もこれを知っています。ほとんどのものは、メモリを犠牲にして速度と応答性のために最適化されています。8 GB は、以前ほど重要ではありません。

もう 1 つのオプションは、使用するすべてのファイルを別のハードドライブに移動し、そのドライブのディスク キャッシュを明示的にオフにすることです。

答え2

私もまったく同じ問題を抱えていました。これは「intellimem.exe」というプロセスで、それを削除したら、RAM とページ ファイルの 80% がページ ファイルなし、RAM 使用率 20% に変わりました。問題はなくなりました。

関連情報