-1

I have an C# application that is using few threads (specially for showing graphic chart and get data from a device).

After some uses my app becomes slower and I must restart computer to solve this problem.

How can I solve this problem?

TaW
  • 53,122
  • 8
  • 69
  • 111
Ali
  • 3
  • 2
  • Memory leak seems to be the reason. Run your application and observe memory, thread count and handles. You can monitor these using task manager. You need to correct whichever is increasing over time. – MKR Jul 16 '17 at 08:44
  • No.30% of ram of my pc is still free in this condition. – Ali Jul 16 '17 at 12:02
  • What about utilization of CPU and thread counts for your application? You can check these from TaskManager. – MKR Jul 16 '17 at 12:22
  • no.this is not the problem.actually I use thread for getting data from a device that controlled from my app.i get data then do some calculation and show graph for user – Ali Jul 16 '17 at 13:37

2 Answers2

0

Can you ensure that your application in not running in the background when you close it. You may check it in TaskManager. If it is not there, the process was terminated and all threads that belong to app are terminated too.

There may be some unmanaged resources that your app didn't release.

opewix
  • 4,993
  • 1
  • 20
  • 42
0

There is two types of Thread. They are Background and Foreground. If your threads are Foreground the application will not close until all foreground threads are finished.

https://learn.microsoft.com/en-us/dotnet/standard/threading/foreground-and-background-threads

And you should dispose all your unmanaged resources as @opewix says.

What is IDisposable for?

Cihan Yakar
  • 2,402
  • 28
  • 30