Is it true that in .NET the garbage collector gets called when you minimize the program?

后端 未结 6 1184
野趣味
野趣味 2020-12-10 12:00

I had created a program in C#. That program used about 60-70 MB of my memory. But when I minimized that program, it required less memory, that is, just 10 MB.

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-10 12:38

    This has nothing to do with garbage collection - this happens with non .NET programs too (try minimizing your browser while looking at the memory footprint for it).

    The moment you minimize a program, the windows OS will not longer need to keep the UI components in memory, hence the memory requirements are lower.

    That is - windows trims the working set when an application is minimized.

    See this channel9 thread and this KB article (thanks @Sasha Goldshtein).

提交回复
热议问题