System GC interface or events?

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Is there an interface or events in the system that occurs pre and post
garbage collection that one of my objects can attach to? I need to know in
my application when garbage collection is about to take place and when it
has completed. This is to make sure a system critical event does not happen
while the application is frozen, if it freezes for longer than 2 seconds.
Thanks!
 
Hi Bob

No, there are no GC events you can monitor to find out when a GC will occur or has occurred.

What kind of critical event are you concerned out?


Thanks
-Chris

--------------------
From: "Bob" <[email protected]>
Subject: System GC interface or events?
Date: Mon, 19 Jan 2004 08:40:18 -0800
Lines: 8
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: blv-gate-01.boeing.com 130.76.32.64
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:121819
X-Tomcat-NG: microsoft.public.dotnet.general

Is there an interface or events in the system that occurs pre and post
garbage collection that one of my objects can attach to? I need to know in
my application when garbage collection is about to take place and when it
has completed. This is to make sure a system critical event does not happen
while the application is frozen, if it freezes for longer than 2 seconds.
Thanks!


--

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.
 
There are some in our group that are afraid that .NET will freeze the
application for up to 15 seconds doing garbage collection when the system
must respond within 1 second of a button press. From the analysis I have
done to date, I don't see that happening. I'm just trying to come up with
anything that would appease their concerns.

Thanks!

"Chris Lyon [MSFT]" said:
Hi Bob

No, there are no GC events you can monitor to find out when a GC will occur or has occurred.

What kind of critical event are you concerned out?


Thanks
-Chris

--------------------
From: "Bob" <[email protected]>
Subject: System GC interface or events?
Date: Mon, 19 Jan 2004 08:40:18 -0800
Lines: 8
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: blv-gate-01.boeing.com 130.76.32.64
Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.
phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:121819
X-Tomcat-NG: microsoft.public.dotnet.general

Is there an interface or events in the system that occurs pre and post
garbage collection that one of my objects can attach to? I need to know in
my application when garbage collection is about to take place and when it
has completed. This is to make sure a system critical event does not happen
while the application is frozen, if it freezes for longer than 2 seconds.
Thanks!
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.
 
Hi Bob

There is no reason to expect a delay like that. There are ways to minimize collection delay times when designing an interactive managed application. For example:

-avoid using finalizers. Objects in the finalization queue tend to hang around longer and require more overhead when collecting
-avoid forcing generation 2 collections by calling GC.Collect(). Gen2 collections are expensive performance-wise.
-if possible, use concurrent GC (on multi-proc machines). This setting allows generation 2 collections to occur while the program is running

See these articles for more information:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/fastmanagedcode.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/dotnetgcbasics.asp
http://weblogs.asp.net/ricom/archive/2003/12/02/40782.aspx (or any other posts by Rico).

You might also want to monitor the microsoft.public.dotnet.framework.performance newsgroup.

If you have any other questions, let me know

Thanks
-Chris



--------------------
From: "Bob" <[email protected]>
References: <[email protected]> <[email protected]>
Subject: Re: System GC interface or events?
Date: Mon, 19 Jan 2004 17:34:28 -0800
Lines: 64
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: blv-gate-01.boeing.com 130.76.32.64
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:121873
X-Tomcat-NG: microsoft.public.dotnet.general

There are some in our group that are afraid that .NET will freeze the
application for up to 15 seconds doing garbage collection when the system
must respond within 1 second of a button press. From the analysis I have
done to date, I don't see that happening. I'm just trying to come up with
anything that would appease their concerns.

Thanks!

"Chris Lyon [MSFT]" said:
Hi Bob

No, there are no GC events you can monitor to find out when a GC will occur or has occurred.

What kind of critical event are you concerned out?


Thanks
-Chris

--------------------
From: "Bob" <[email protected]>
Subject: System GC interface or events?
Date: Mon, 19 Jan 2004 08:40:18 -0800
Lines: 8
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: blv-gate-01.boeing.com 130.76.32.64
Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.
phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:121819
X-Tomcat-NG: microsoft.public.dotnet.general

Is there an interface or events in the system that occurs pre and post
garbage collection that one of my objects can attach to? I need to know in
my application when garbage collection is about to take place and when it
has completed. This is to make sure a system critical event does not happen
while the application is frozen, if it freezes for longer than 2 seconds.
Thanks!
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.


--

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