Strange behavior - Gen0:Gen1:Gen2 has the ratio 10:10:1

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.

Moderator: SciTech Software

Strange behavior - Gen0:Gen1:Gen2 has the ratio 10:10:1

Postby tsh » Tue Feb 18, 2014 3:15 am

Hi all,

I have a few programs that exhibit a strange behavior: the number of Gen0 and Gen1 collection is almost the same throughout their life time. That is Gen0:Gen1:Gen2 has the approximate ratio of 10:10:1. Other programs run with Gen0:Gen1:Gen 2 in the approximate ratio of 100:10:1 which from what I understand is more typical.

When I use .NET Memory Profiler to trigger an Gen0 collection, I see in the real time graph that a Gen1 collection is also triggered.

What could cause such behavior? Has anyone else encountered this and figured out what caused it? Could it be related to the way I use TCP and UDP sockets, file streams or locks? How can I diagnose this using .NET Memory Profiler (4.6)?

Regards,
tsh
tsh
 
Posts: 1
Joined: Tue Feb 18, 2014 3:04 am

Re: Strange behavior - Gen0:Gen1:Gen2 has the ratio 10:10:1

Postby Andreas Suurkuusk » Fri Feb 21, 2014 7:34 am

I'm sorry for the late reply.

The ratio between the collection generations can differ substantially depending on the allocation pattern and the life-time of the allocated instances. However, having the same amount of gen #0 and gen #1 collections seems a little unusual.

I assume that this could happen if you mainly allocate instances that need to be finalized. If the runtime performs a gen #0 collection when only finalizable instances have been created, then all instances will be queued for finalization and nothing gets collected. So the runtime has to perform a gen #1 collect to actually collect any instances. At the time of the gen #1 collection, the instances that were queued for finalization have most likely been finalized and can now be collected.

If you wish to see whether there a lot of instances being finalized, you can add the "Finalized instances" band to the types list (using the command View->Layout->Column chooser).
Best regards,

Andreas Suurkuusk
SciTech Software AB
Andreas Suurkuusk
 
Posts: 980
Joined: Wed Mar 02, 2005 7:53 pm
Location: Sweden


Return to Using .NET Memory Profiler

Who is online

Users browsing this forum: No registered users and 3 guests

SciTech Software logo

© Copyright 2001-2016. SciTech Software AB
All rights reserved.


SciTech Software AB
Kartvägen 21
SE-175 46 Järfälla
Sweden


E-mail: mail@scitech.se

Telephone: +46-706868081

cron