|
-
Jul 8th, 2013, 01:34 PM
#1
Memory Leak? GarbageCollector Gen0 Objects are only increasing
In my application the number of GC Gen0 objects is constantly increasing, nearly none are moved to Gen1 nor are any released by explicitly calling GC.collect.
Where/How could I look for the cause?
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Jul 8th, 2013, 01:57 PM
#2
Re: Memory Leak? GarbageCollector Gen0 Objects are only increasing
Don't look for the cause, you shouldn't be forcing a garbage collection in your situation. As I told you in your other thread, the system isn't reclaiming the memory because there is no pressure to do so, nothing else needs the resources. This is the point of a managed memory environment.
[Edit: Also, if the objects stay in Gen0 after calling GC.Collect then you're doing something wrong. Any object that survives a collection of its generation gets promoted, so if all your objects are still in Gen0 then you've not done a collection. They will either be reclaimed or promoted to Gen1.]
-
Jul 8th, 2013, 01:58 PM
#3
Re: Memory Leak? GarbageCollector Gen0 Objects are only increasing
Use a memory profiler to see what types of objects there are, and what is keeping them open. There is one I believe in VS2012 (I have not used it), or buy/find an external one. In the past I have used one such as redgates.
I have found the simple way to find leaks (if this is what you actually have, after reading evil's post), is to take a snapshot after loading everything once, open/process again and take another snapshot and compare the deltas, if your app is growing, it will the because of the class with the highest unexpected delta change.
Last edited by Grimfort; Jul 8th, 2013 at 02:01 PM.
-
Jul 8th, 2013, 02:07 PM
#4
Re: Memory Leak? GarbageCollector Gen0 Objects are only increasing
Is the memory being retained even needed?
-
Jul 8th, 2013, 02:15 PM
#5
Re: Memory Leak? GarbageCollector Gen0 Objects are only increasing
Started me humming a song by the Who. My g-g-g-generation!
My usual boring signature: Nothing
 
-
Jul 8th, 2013, 02:22 PM
#6
Re: Memory Leak? GarbageCollector Gen0 Objects are only increasing
You do realize running the GC has alot of costs. Well some. Do you have any free memory left? It's better for the process to ask for more memory then clean up all your objects. Asking for more memory is cheaper. Obviously if there is no more memory then we have to call the GC. In actual fact i guess it could be an allocation choice issue.
-
Jul 8th, 2013, 02:35 PM
#7
Re: Memory Leak? GarbageCollector Gen0 Objects are only increasing
I using the .collect just for TESTING, and I´m doing this test just because I saw this weird numbers Gen0 increases constatly (by roughly 125 per sec or iteration) Gen1 increases only by 1 every 10secs and Gen2 increases by 1 every minute.
Evil_Giraffe, I DID listen to you!
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|