Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / January 2006

Tip: Looking for answers? Try searching our database.

How many bytes were collected?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ravi Ambros Wallau - 16 Jan 2006 20:54 GMT
Hi:
   Is there a way to know how many bytes were purged in last garbage cycle?

Signature

Ravi
rwallau@_RemoveThisTextAndUnderscores_springwireless.net

Naveen - 16 Jan 2006 21:40 GMT
Why would want to know? Is there any specific requirement? The
information can be obtained by using the CLR Hosting interface
ICLRGCManager::GetStats  which returns

typedef struct _COR_GC_STATS {
   ULONG   Flags;
   SIZE_T  ExplicitGCCount;
   SIZE_T  GenCollectionsTaken[3];
   SIZE_T  CommittedKBytes;
   SIZE_T  ReservedKBytes;
   SIZE_T  Gen0HeapSizeKBytes;
   SIZE_T  Gen1HeapSizeKBytes;
   SIZE_T  Gen2HeapSizeKBytes;
   SIZE_T  LargeObjectHeapSizeKBytes;
   SIZE_T  KBytesPromotedFromGen0;
   SIZE_T  KBytesPromotedFromGen1;
} COR_GC_STATS;
Willy Denoyette [MVP] - 16 Jan 2006 22:49 GMT
You can get watch the Gen0, 1, 2 and large object heap sizes from the "CLR
memory" performance counters using perfmon, or from code by using the
System.Diagnostics.Performance class.

Willy.

| Hi:
|    Is there a way to know how many bytes were purged in last garbage cycle?
Naveen - 16 Jan 2006 23:26 GMT
Can you know the bytes were purged in last garbage cycle using the
System.Diagnostics.Performance class?
Willy Denoyette [MVP] - 17 Jan 2006 10:27 GMT
| Can you know the bytes were purged in last garbage cycle using the
| System.Diagnostics.Performance class?

There is no exact counter for that, so you need to take snapshots at regular
intervals and compare the Gen0..2 collections counters and the Gen0..2
sizes. However it's not possible to say how much there has been collected
when the GC frequency is higher than the snapshot frequency. Note that the
CLR doesn't (for performance reasons)update the performance counters at each
GC run when the frequency exceeds a certain threshold.

Willy.
Ravi Ambros Wallau - 17 Jan 2006 12:19 GMT
I tried another approach and it did work for me, that's monitoring how many
bytes are allocated before and after the garbage collector cycle.
Thanks,
   Ravi.

> Hi:
>    Is there a way to know how many bytes were purged in last garbage
> cycle?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.