Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
421 views
in Technique[技术] by (71.8m points)

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

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.

When I maximized or came back to that program it used 20 MB...

Why does this happen?

Is it true that garbage collector gets called when you minimize the progam?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...