Salakhetdinov Shamil
mcp2004 at mail.ru
Thu Apr 5 06:58:44 CDT 2012
Hi John -- > So you are saying that you discovered the GC taking a huge chunk of > processor cycles without end in one of your apps? Yes. I have had such trouble in the past in one of the apps I had developed. GC might go "crazy endless looping" sometimes... And you can try googling - there should be information on such a case... You noted that you used delegates/event handlers - they could be "guilty" as they create circular object references, which GC can't drop sometimes - and it "goes nuts" ... When using delegates and/or event handlers, which create circular references always use IDisposable and .Dispose(...) to explicitly clear all circular references otherwise you'll get memory leakage issues and "GC going crazy loops" in the case of heavy load apps... Thank you. -- Shamil Thu, 05 Apr 2012 07:30:14 -0400 от jwcolby <jwcolby at colbyconsulting.com>: > > That's experience not theory I'm talking here from. > > But the GC should do it's thing and be done. This just sits at ~25% processor utilization forever. > And why would the GC not do the same thing if I used the timer. The timer runs the process one > time and then the system has control again. GC could run then as well, but there is no 25% > processor usage (ever) with the timer model, only when the thread slept. > > > If only you don't have any other processes blocked by your application heavy processor workload > while it's active. > > While there are times when the processor is heavy duty working, in this case it was not. Basically > the thread was reading a recordset from SQL Server and looking at whether the records were in my > Supervisor cache, and putting the records in the cache if not. It was literally coasting. The > cache was loaded, it was taking milliseconds to do the read and then sleeping for 10 seconds, then > doing the read, then sleeping for 10 seconds. > > During those 10 second sleeps, the processor usage jumped. If the GC were to routinely take 25% of > the total CPU power then MS needs to look at that! > > > Do you have your old code preserved? > > I do but only as a revision in source control. I have moved on. > > > That's experience not theory I'm talking here from. > > So you are saying that you discovered the GC taking a huge chunk of processor cycles without end in > one of your apps? > > John W. Colby > Colby Consulting > > Reality is what refuses to go away > when you do not believe in it > > On 4/5/2012 5:07 AM, Salakhetdinov Shamil wrote: > > Hi John, > > > > That's experience not theory I'm talking here from. > > And it's very likely you've GC getting busy there when .Sleep(...) is called and your main thread/app is getting suspended. > > If only you don't have any other processes blocked by your application heavy processor workload while it's active. > > Do you have your old code preserved? > > > > Thank you. > > > > -- Shamil > > > > > > Wed, 04 Apr 2012 18:00:54 -0400 от jwcolby<jwcolby at colbyconsulting.com>: > >> Interesting theory but it seems unlikely. I switched to running the function on a thread from the > >> timer and this CPU spike no longer occurs > >> > >> John W. Colby > >> Colby Consulting > >> > >> Reality is what refuses to go away > >> when you do not believe in it > >> > >> On 4/4/2012 3:46 PM, Salakhetdinov Shamil wrote: > >>> Hi John, > >>> > >>> GC is abbreviation for Garbage Collector. > >>> Learning to be concise here :) > >>> > >>> Thank you. > >>> > >>> -- Shamil > >>> > >>> > >>> Wed, 04 Apr 2012 15:10:54 -0400 от jwcolby<jwcolby at colbyconsulting.com>: > >>>> LOL. GC? What is GC? > >>>> > >>>> John W. Colby > >>>> Colby Consulting > >>>> > >>>> Reality is what refuses to go away > >>>> when you do not believe in it > >>>> > >>>> On 4/4/2012 12:41 PM, Salakhetdinov Shamil wrote: > >>>>> GC ? > >>>>> > >>>>> > >>>>> Wed, 04 Apr 2012 10:02:28 -0400 от jwcolby<jwcolby at colbyconsulting.com>: > >>>>>> I am baffled by what I am seeing in my threaded program. I start a thread which basically pulls > >>>>>> data from SQL Server. It does so then does a thread.sleep(10000) which should sleep for 10000 ms > >>>>>> (10 seconds). During the sleep, the processor usage jumps to roughly 25%. > >>>>>> > >>>>>> That indicates that the sleep enables something else to go bonkers but what is that "something else" > >>>>>> and why does it depend on this thread sleeping? I really don't want my app consuming 25% of the > >>>>>> processor sleeping. > >>>>>> > >>>>>> On Google I see this question posted on many venues but no real answer. > >>>>>> > >>>>>> In fact I decided that what I was really trying to accomplish was provided by a timer class so I am > >>>>>> in the process of rewriting my code to use the timer. I did it in one place and it works well, no > >>>>>> more do while / thread.sleep for me. > >>>>>> > >>>>>> I'd still like to know what caused the system to spike CPU usage when the thread was sleeping though. > >>>>>> > >>>>>> -- > >>>>>> John W. Colby > >>>>>> Colby Consulting > >>>>>> > >>>>>> Reality is what refuses to go away > >>>>>> when you do not believe in it > >>>>>> > >>>>>> _______________________________________________ > >>>>>> dba-VB mailing list > >>>>>> dba-VB at databaseadvisors.com > >>>>>> http://databaseadvisors.com/mailman/listinfo/dba-vb > >>>>>> http://www.databaseadvisors.com > >>>>>> > >>>>>> > >>>>> > >>>>> _______________________________________________ > >>>>> dba-VB mailing list > >>>>> dba-VB at databaseadvisors.com > >>>>> http://databaseadvisors.com/mailman/listinfo/dba-vb > >>>>> http://www.databaseadvisors.com > >>>>> > >>>> > >>>> > >>> > >>> _______________________________________________ > >>> dba-VB mailing list > >>> dba-VB at databaseadvisors.com > >>> http://databaseadvisors.com/mailman/listinfo/dba-vb > >>> http://www.databaseadvisors.com > >>> > >> > >> > > > > _______________________________________________ > > dba-VB mailing list > > dba-VB at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-vb > > http://www.databaseadvisors.com > > > >