By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 968 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

System GC interface or events?

P: n/a
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!
Jul 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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" <rv@b.com>
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: <O$**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.general
NNTP-Posting-Host: blv-gate-01.boeing.com 130.76.32.64
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.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.

Jul 21 '05 #2

P: n/a
Bob
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]"" <cl***@online.microsoft.com> wrote in message
news:gY**************@cpmsftngxa07.phx.gbl...
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" <rv@b.com>
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: <O$**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.general
NNTP-Posting-Host: blv-gate-01.boeing.com 130.76.32.64
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!tk2msftngp13.
phx.gblXref: 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 inmy 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 happenwhile 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.

Jul 21 '05 #3

P: n/a
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/de...anagedcode.asp
http://msdn.microsoft.com/library/de...etgcbasics.asp
http://weblogs.asp.net/ricom/archive.../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" <rv@b.com>
References: <O$**************@tk2msftngp13.phx.gbl> <gY**************@cpmsftngxa07.phx.gbl>
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: <ef**************@TK2MSFTNGP11.phx.gbl>
Newsgroups: microsoft.public.dotnet.general
NNTP-Posting-Host: blv-gate-01.boeing.com 130.76.32.64
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!cpmsftng xa09.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]"" <cl***@online.microsoft.com> wrote in message
news:gY**************@cpmsftngxa07.phx.gbl...
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" <rv@b.com>
>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: <O$**************@tk2msftngp13.phx.gbl>
>Newsgroups: microsoft.public.dotnet.general
>NNTP-Posting-Host: blv-gate-01.boeing.com 130.76.32.64
>Path:cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFT NGP08.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 knowin >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 nothappen >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.


--

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.

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.