Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close program - process remains and goes to 100% CPU

Status
Not open for further replies.

Sypher2

Programmer
Oct 3, 2001
160
US
I can't seem to figure out why this is happening...

We have a program which displays a lot of data from a database. This program provides near real-time display of information. It reads from the database every 10 seconds and refreshes the screen. It also has various reports.

If the program has been running for many days and then is closed, the process will remain in Task Manager and use up all the processor. The task has to be ended in Task Manager for it to go away.

Any idea what the cause of this might be? I know this is a broad question, but any ideas might get me on track.
 
What's your memory consumption like?

You can also view many .net specific process counters in perfmon to see what might be happening.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
do a search for kill thread. You might want to take a look at process kill method (I think it is). It may be able to kill the active process if it doesn't die.

When you shut down the application,a re you completing the processing of any db activity and closing the db's?
 
Yes, I believe the DB is being closed correctly.

I am using Excel for the reports. I have a hunch that's the culprit. If the COM object isn't being released, I'm unsure why and what to do about it. I'm using this code in the Unload event:
Code:
Runtime.InteropServices.Marshal.ReleaseComObject(xl)
xl = Nothing
GC.Collect()
 
Try this to ensure Excel is getting closed correctly
Code:
xlapp.Workbooks.Close()
xlapp.Quit()

While System.Runtime.InteropServices.Marshal.ReleaseComObject(xlapp) <> 0
End While

xlapp = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()


Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top