c# - Reducing the amount of threads in a .NET application -


I use a medium-sized process viewer that ~ around 40MB of personal memory on Windows Vista. The problem is that people are always compared to this number of process explorers and the amount of memory used by the unmanaged device, similarly

I have noticed that when my program remains empty, there are 13 floating threads .

  • An RPC thread (RPCRT4.dll! ThreadStartRoutine)
  • The thread related to a com (ole32.dll! CoRegisterSurrogateEx + 0x35e0)
  • Two ntdll Thread (ntdll.dll! TppWorkerThread, ntdll.dll! TppWaiterpThread)
  • The main GUI thread
  • A timer thread (used by CLR)
  • Gate thread (<
  • Debugger thread (CLR)
  • 4 worker thread (mscorwks.dll! Thread :: intermediate threadproc)
  • and finally a GDI + background thread (gdiplus) .dll! BackgroundThreadProc)

I release some threads, 1 thread (1MB each) from these threads You can get rid of Ane? ThreadPool.GetAvailableThreads tells me that there are 0 worker threads running, but there are 3 "intermediate threadprocers" threads. Can Service Manager API use any connection with RPC thread? (This RPC calls.)

13 threads are very low. Unfortunately, you will be able to get rid of most of these threads without cutting functionality.

RPC & amp; Com is probably not possible for the managed app, and CLR threads seem to be useful, I think you are using GDI + (possibly the system drawing.) Even though 0 workers threads are running here, threads in Threadpool " "On standby, is ready to begin. You do not want to post work items, so that the upper part of creating a new thread in the idle process is to be raised.

Even if you're using 40MB of personal memory, it is probably possible for the number of threads even if each thread is fully using its 1MB default stack (Which they are definitely not, most stack is reserved but not committed and will not be shown as private bytes), it is only 13 MB of 40 MB you are watching what you are allocating your application to see Ltd The CLR can use Profiler?


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -