SetProcessWorkingSetSize - What's the catch?

前端 未结 4 1469
离开以前
离开以前 2020-12-15 22:38

I found an article on About.com that tells you how you can manage your apps memory.

Here is the code:

procedure TrimAppMemorySize;
var
  MainHandle :         


        
4条回答
  •  我在风中等你
    2020-12-15 22:57

    The "catch" as it were is that you have just told the operating system to remove pages from your working set that are actually in RAM. Assuming the OS is removing pages that don't have data you will ever access again, there's no problem. But if it's paging out data that your process will need in the future, you've just told Windows "More page faults, please."

    The main issue with this code is that you're essentially sacrificing your own process's performance for the sake of the rest of the system (though thrashing actually harms the whole system.) That's somewhat noble, but clearly not "catch" free.

提交回复
热议问题