- Why my WPF application becomes slow after a while of minimizing?
- 第2回 Visual Studioのプロファイラを使って性能評価を行う
1に上げた参考情報の回答部分を引用と拙訳
This is not a property of WPF, it's a property of virtual memory.
これはWPFの特性じゃなくて、仮想メモリの特性です。
Basically, modern operating systems attempt to make the programs that are running as fast as possible - but they also allow many programs to run at once, more than all of their memory could fit into your measely RAM at once. So when the OS sees that a running program needs to allocate a new page of memory, but RAM is full of pages already, it kicks one of the pages (preferring ones that have not been used in a while) to the hard disk, into a file called the page file.
基本的に、最近のOSはプログラムを出来る限り速く動作させようとしますが、同時にたくさんのプログラムを動作させる必要や大量のメモリも必要とします。そこで、OSは動作しているプログラムが新たなメモリページの確保を必要としたとき、RAMが既にページングできる分が無かったら、一部のメモリページをハードディスクに追い出してページファイルと呼ばれるファイルキャッシュの中に入れます。
When the program for which that page of memory belonged to attempts to access it, this is called a 'page fault' - the OS detects the page is not in RAM but on disk, and has to read it into RAM before execution continues. This is relatively slow since reading from the hard disk is slower than reading from RAM. If a program hasn't been running for some time, it's conceivable that ALL of its pages have been paged out to RAM - and so it will be slow until it stops hitting page faults.
プログラムが上記のキャッシュ化されたメモリページにアクセスしようとすることを「ページフォールト」と呼びます。OSはRAM上にそのメモリがなくてハードディスク上にあると検知すると、プログラムの処理を実行する前に読み出してメモリ上に上げます。この挙動は、メモリから直接読むよりも遅いです。もし当該プログラムが、しばらく前から動いていない場合、そのプログラムが使うメモリページ全部がRAM上から追い出されていることが考えられ、当然ページフォールトにヒットしている限り遅くなるでしょう。
以下、質問を書いた人がうまくいったと報告した内容の引用と拙訳