Gaps in Generation #0

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

Moderator: SciTech Software

Gaps in Generation #0

Postby acavender » Thu Aug 14, 2014 2:12 pm

Under Native Memory->Managed heaps->Normal heap->Generation #0, I am seeing the following numbers (see attached screenshot):
Code: Select all
Generation #0           41,282 KB
Reachable instances     13 KB
Gaps                    41,269 KB


This is the situation after running a snapshot. I am concerned about the 41MB gap in Gen #0 because this tells me that compaction is not going to be working. Gen #1 and Gen #2 look pretty normal to me (see screenshot). Does this imply there is memory being pinned in the Gen #0 heap that is preventing it from being fully compacted? I would expect if the 13 KB was toward the bottom part of the Generation #0 help, then the area above would be classified as Unused instead of a Gap.

Is this something I should be concerned about? If so, then what are some techniques to isolate that is causing the gap? I have looked at pinned memory instances, but nothing showed up as being in Gen #0.

Thanks,
-Aaron
Attachments
Memprofiler-gen0.png
Screenshot of Native Memory/Gen #0
acavender
 
Posts: 2
Joined: Thu Aug 14, 2014 1:49 pm

Re: Gaps in Generation #0

Postby Andreas Suurkuusk » Sun Aug 17, 2014 10:04 pm

I have never seen a gap this big in the generation #0 heap, but I guess that it's possible that it could happen due to pinned instances. The runtime is able to perform allocations within gaps as well, but it does add some complexity to allocator and garbage collector, so it's desirable too avoid gaps like this.

You say that you don't have any pinned instances in gen#0. Do you have a lot of pinned instances in the other generations? How did you collect the heap snapshot (full snapshot or gen #0)?

We are looking into the native memory presentation to make sure that we are not accidentally presenting overhead as gaps.
Best regards,

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

Re: Gaps in Generation #0

Postby acavender » Tue Aug 19, 2014 4:23 pm

Andreas,

Thanks for the reply. I have been using full snapshots (and not just Gen #0). Your confirmation that this is likely an errant pinned piece of memory is pointing me back to doing a more thorough search of pinned instances. I could use a pointer to help, though. Is there a way in Memory Profiler to tell what generation a particular instance resides? I do not see anything obvious. If there was something like that, then I think this may not be too hard to track down.

-Aaron
acavender
 
Posts: 2
Joined: Thu Aug 14, 2014 1:49 pm

Re: Gaps in Generation #0

Postby Andreas Suurkuusk » Wed Aug 20, 2014 8:15 pm

There are filters available for all generations, "Gen #0 instances", "Gen #1 instances", and "Gen #2 instances", but they are not added by default.To add a "Gen #0 instances" filter, use the command "Profiler->Manage filters", select "Gen #0 instances" in the list and click "Add filter".

Gen0Filter.png
Add Gen #0 filter


Hopefully this filter, together with "Pinned instances" analysis issue will help you locate the problem.
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