.NET WinForm Memory Consumption

前端 未结 3 1218
小蘑菇
小蘑菇 2020-12-21 15:36

I\'ve been profiling a WinForm\'s application using \".NET Memory Profiler\".

I can\'t quite seem to understand how my application is growing to 1GB, then 2GB, then

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-21 16:04

    I can't quite seem to understand how my application is growing to 1GB, then 2GB, then 3GB of usage - according to windows task manager.

    That's because the counter from task manager is the "working set" as Tess Ferrandez points out in this article

    There is another counter called working set which simplified consists of how much memory is in the memory pages that are currently or was recently touched by threads in the process or approximately, how much of the memory that is used by the process is currently in RAM. The working set counter might be interesting if you have issues with too much paging and many processes on the same box competing about the RAM, but in order to determine how much memory you are using (reserved or committed) it offers little or no help.

    From the MSDN article on working set (Emphasis mine)

    Working Set

    The set of memory pages (areas of memory allocated to a process) recently used by the threads in a process. If available memory on the server is above a specified threshold, pages remain in the Working Set of a process even if they are not in use. When available memory falls below a specified threshold, pages are removed from the Working Set. If these pages are needed, they will be returned back to the Working Set before they leave main memory and are made available for other processes to use.

提交回复
热议问题