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

后端 未结 6 1171
野趣味
野趣味 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:40

    Garbage collection in .NET occurs when all your objects are dead or when you close the program. You can also call the garbage collector in .NET, but it's not generally practiced. And while in minimized mode the program, though working (or alive or whatever you can call), is not in focus or actively used by the user. So the memory use (system resources) that has been alloted to the program reduces so the other programs may use the system resources.

提交回复
热议问题