What are the side effects of using EmptyWorkingSet?

后端 未结 2 1756
时光说笑
时光说笑 2021-01-02 17:38

I\'m using the code below to free up memory on some running programs because my own program needs large memory resources to run faster.

[DllImport(\"psapi.dl         


        
相关标签:
2条回答
  • 2021-01-02 18:10

    I suspect the side-effect will be performance of those other programs - the system will bring the pages swapped out by the call to EmptyWorkingSet() back in when the process needs them.

    Messing with the system at such a low level is fraught with danger: in particular, Explorer page faults may slow the system down to the point where strange deadlocks start to rear their ugly heads. Best to leave this to Windows, in particular for other programs that you didn't write.

    You may find it more efficient to understand why your own program needs so much memory. Is there a leak somewhere, perhaps?

    0 讨论(0)
  • 2021-01-02 18:34

    Personally, I've not deal with this. Seems kind of 'dangerous' :P

    Anyway, some articles you might find helpful:
    Performance Issues with EmptyWorkingSet
    Memory management - forcing a process to free it's memory

    0 讨论(0)
提交回复
热议问题