![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
I can't think of any reason why the GC won't collect all inaccessible memory. |
#4
| |||
| |||
|
|
"Peter Ritchie [C# MVP]" <PRSoCo (AT) newsgroups (DOT) nospam> wrote I can't think of any reason why the GC won't collect all inaccessible memory. The only thing that comes to mind is fragmentation. GC.Collect typically does the collection and them performs a compaction. When the heap is fragmented, that compaction doesn't work very well, and you can end up without much "free" memory... -- Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP http://www.coversant.com/blogs/cmullins |
#5
| |||
| |||
|
|
That shouln't cause a particular object to not be collected though. My interpretation of "memory leak" could have been different than yours or Ward's. Mine what that a particular object wasn't collected... I don't pay attention to usable space as an indiciation of memory leaks. Due, as you say, to fragmentation... -- Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote. http://www.peterRitchie.com/blog/ Microsoft MVP, Visual Developer - Visual C# "Chris Mullins [MVP]" wrote: "Peter Ritchie [C# MVP]" <PRSoCo (AT) newsgroups (DOT) nospam> wrote I can't think of any reason why the GC won't collect all inaccessible memory. The only thing that comes to mind is fragmentation. GC.Collect typically does the collection and them performs a compaction. When the heap is fragmented, that compaction doesn't work very well, and you can end up without much "free" memory... -- Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP http://www.coversant.com/blogs/cmullins |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
I need to know because I'm looking for memory leaks in an application. |
#8
| |||
| |||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |