GC.Collect can be trusted?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

I'm wondering if the GC.Collect method really collects all objects possible objects? Or is this still a "smart" process sometimes keeping objects alive even if they can be garbage collected?

I need to know because I'm looking for memory leaks in an application.

It would be really helpful to be able to determine if an object after manually invoking the GC.Collect is only kept alive because it still being referenced by other alive objects in contrast to being alive because the GC.Collect didn't found it necessary to collect the object, even when asked explicitly.

Regards,

Ward
.