answersLogoWhite

0

Memory management (including releasing memory) is always handled by the Garbage Collector. Generally you would allow the garbage collector to run automatically.

In some situations you may want to ask the garbage collector to collect sooner. In these cases you can call System.GC.Collect(). You can also implement the IDisposable interface on any classes that require special handling by the garbage collector, such as releasing database connections, file handlers or COM objects.

The garbage collector does not manage COM objects. If you are working with COM objects, I recommend you read the following article:
Beyond (COM) Add Reference: Has Anyone Seen the Bridge?
http://msdn.microsoft.com/en-us/library/ms973274.aspx

User Avatar

Wiki User

15y ago

What else can I help you with?