Real time instance data not updated until snapshot

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

Moderator: SciTech Software

Real time instance data not updated until snapshot

Postby JamesDeadman » Thu Dec 10, 2009 12:14 pm

Hi,
I am profiling an application to check when instances get diposed/removed. I am using the real-time view, and when i destroy an object the "live instances" never seems to get updated until i go to the menu and select "Collect heap snapshot". Then it suddenly updates all the instances.

Can i please ask how i can refresh the data in real-time as i was hoping without needing to perform to a snapshot to update the real time view?

Thank you.

James
JamesDeadman
 
Posts: 2
Joined: Thu Dec 10, 2009 12:09 pm

Postby Andreas Suurkuusk » Thu Dec 10, 2009 4:40 pm

It's only possible for the profiler to retrieve this value when the runtime is suspended for a GC (and the heap is in a stable state). Therefore the "Live instances" value is only updated after a garbage collection (generation #0, #1, and #2). The "Total instances" value is updated each second, but it includes all instances that exist on the GC heap, even the unreachable ones.

When you collect a heap snapshot, a GC will be induced, which will force the "Live instances" value to be updated.

You can use the GC.Collect() method within the profiled process to force the "Live instances" value to be updated, but this should only be done for testing purposes. To minimize the effect on memory usage, I recommend that you only perform a generation #0 collect (GC.Collect(0)).
Best regards,

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

Postby JamesDeadman » Thu Dec 10, 2009 5:12 pm

Hi Andreas,

Thanks for your help. :)

I see what you mean regarding the garbage collection, i will try your suggestion for testing with the GC.Collect() function too.

Thanks,
James
JamesDeadman
 
Posts: 2
Joined: Thu Dec 10, 2009 12:09 pm

Re: Real time instance data not updated until snapshot

Postby pavithra rani » Tue Dec 06, 2016 1:54 pm

Hi Andreas,

I also face the similar situation, where i Need to find whether my application would perform Garbage collection properly.
I am performing addition of devices and performing one operation at each stage. Checking at each stage how much is the Total Instances & Live instances (last GC ) .

As per real time data: Total instances keep getting added. GC would never gets updated. This gave me an impression like GC is not happened successfully.

Kindly suggest without the memory snapshot how to get exact results. When I do snapshot real time data gets updated also GC . This is not right!

Thanks,
Pavithra
pavithra rani
 
Posts: 2
Joined: Tue Dec 06, 2016 1:45 pm

Re: Real time instance data not updated until snapshot

Postby pavithra rani » Tue Dec 06, 2016 2:09 pm

Also , once the snapshot captured, it is getting updated . This dynamic behavior is unable to predict the actual results.

Either real time data should get updated properly. Or else snapshot should not get updated once captured.


Please let me know if this issue is addressed somewhere else.

thanks,
pavithra
pavithra rani
 
Posts: 2
Joined: Tue Dec 06, 2016 1:45 pm

Re: Real time instance data not updated until snapshot

Postby Andreas Suurkuusk » Wed Dec 07, 2016 2:28 pm

In what way do you want to check that your application perform a garbage collection properly?

The .NET runtime performs the garbage collection when it needs to collect the managed memory. The actual time when the GC is performed and what generation is collected, depends on several parameters, e.g. the allocation patterns in the application, the amount of memory collected previously, and the amount of memory available on the system. This makes it hard to predict when a GC will occur.

The Live bytes count presented in the real-time view can help you identify how well the garbage collector works. Unfortunately, this value is normally only updated after a full (gen #2) garbage collection. To update it after each garbage collection, you can select the "High" profiling level when you start profiling your application. However, this will cause your application to run slower.

You can read a bit more about the Total bytes/Live bytes real-time data at: http://memprofiler.com/onlinedocs/acomm ... eplots.htm
Best regards,

Andreas Suurkuusk
SciTech Software AB
Andreas Suurkuusk
 
Posts: 957
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 2 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