GC notification event

  • Thread starter Thread starter Paul F. Williams
  • Start date Start date
P

Paul F. Williams

Is there a way to determine when the system has performed a garbage
collection? I would like to be able to write a console message when the CLR
performs a GC. Knowing when a GC happens might help me debug some odd
problems.
 
Hi Paul

Currently there is no notification sent when a GC occurs. One possible solution would be to put a console.writeline in an object's finalizer, since that will only get called when a
collection occurs. The catch, however, is that the CLR makes no guarantees as to when a finalizer gets called (if it gets called at all ).

-Chris


--------------------
From: "Paul F. Williams" <[email protected]>
Subject: GC notification event
Date: Mon, 6 Oct 2003 16:34:14 -0500
Lines: 6
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.general
NNTP-Posting-Host: 204-62-8-212.intervoice-brite.com 204.62.8.212
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:110951
X-Tomcat-NG: microsoft.public.dotnet.general

Is there a way to determine when the system has performed a garbage
collection? I would like to be able to write a console message when the CLR
performs a GC. Knowing when a GC happens might help me debug some odd
problems.


--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.
 
Back
Top