Garbage Colletion

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

Hi,
I want to know how to make certain that those unreferenced memory blocks are
reclaimed by GC after GC.Collect() is called.
By the method of GetTotalMemory, it seems all of alloctated memory is
collected correctly after that call.But the result is a lot different when I
use the System Task Manager to watch by right mouse button on the taskbar in
the desktop, the used memory is almost increasing all the time!

Any reasons?

Thanks a lot.

Alan
 
Alan,

The reason is that from the OS point of view this "free memory" is still
allocated on the CLR managed heap. Only when the GC thinks that the memory
is not going to be allocated again (based on recent trends) is that it
returns it to the OS.

Carlos
--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top