none
Rise in garbage collection of Gen 0, 1 and 2 despite constant bytes in all heaps. Is this sign of memory leak? RRS feed

  • Question

  • I was trying to find memory leak in our software and in doing so I have found that, in Windows built in "Performance Monitor" report-

     1. Garbage collection of Gen 1 and Gen 2  rises exponentially while
        process is doing some work
     2. Garbage collection of Gen 1 & Gen 2 remains constant when process is idle
     3. Garbage collection of Gen 0 continues to increase as time passes by irrespective of process is doing some work or not
     4. Bytes in all heap shows that it is not increasing over time

    Is this normal?

    Performance Monitor Report


    Vaibhav Gawali

    Tuesday, June 21, 2016 10:16 AM

Answers

  • Hi Vaibhav Gawali,

    >>"So I assume that these readings are for single process only."

    Based on this premise, size of Gen raised may be caused by a memory leak. I suggest you restart your application and check whether the size of Gen will cut back.

    In addition, you also need to download CLR Profiler for .NET Framework 4 to see the detail information of following things.

    • Who allocates what on the managed heap.
    • Which objects survive on the managed heap.
    • Who is holding on to objects.
    • What the garbage collector does over the lifetime of your application.

    Here is the document of CLR Profiler for .NET Framework 4.

    https://msdn.microsoft.com/en-us/library/ff650691.aspx?f=255&MSPPError=-2147217396

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, June 28, 2016 9:07 AM
    Moderator

All replies

  • Hi Vaibhav,

    >>"Is this sign of memory leak?  "

    No, it can not be used as evidence of a memory leak. Garbage collection is shared by all the .NET Framework applications and it has many reasons when the size of Gen is raised.

    There is a good article which show us the way of detecting .NET application memory leak. Link below is for your reference.
    Detecting .NET application memory leaks

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, June 23, 2016 6:29 AM
    Moderator
  • >>Garbage collection is shared by all the .NET Framework applications and it has many reasons when the size of Gen is raised.

    In this particular scenario I have explicitly added performance counter for single executable only. And all the time only one process instance of executable existed.

    So I assume that these readings are for single process only.


    Vaibhav Gawali

    Friday, June 24, 2016 4:53 AM
  • Hi Vaibhav Gawali,

    >>"So I assume that these readings are for single process only."

    Based on this premise, size of Gen raised may be caused by a memory leak. I suggest you restart your application and check whether the size of Gen will cut back.

    In addition, you also need to download CLR Profiler for .NET Framework 4 to see the detail information of following things.

    • Who allocates what on the managed heap.
    • Which objects survive on the managed heap.
    • Who is holding on to objects.
    • What the garbage collector does over the lifetime of your application.

    Here is the document of CLR Profiler for .NET Framework 4.

    https://msdn.microsoft.com/en-us/library/ff650691.aspx?f=255&MSPPError=-2147217396

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, June 28, 2016 9:07 AM
    Moderator