wpf - C# STAThreads not being cleaned up - OutOfMemory exception -


i have console application takes input folder, picks files in folder , process them. processing sequentially , each document launches separate stathread runs wpf dependent action inside it.

the application manages process ~1k documents before getting outofmemoryexception , throwing error because dispatcher null.

looking processexplorer can see that:

  • there aren't running/hanging .net threads
  • there ~49k handles allocated when crashes
  • out of these 4k thread handles

questions:

  1. what cause thread handles not released (i can see them being created , deleted live in procexplorer doesn't seem keep rate they're being created).
  2. how see 49k handles ? processexplorer shows 5k items - rest of them?
  3. how can workaround outofmemory exception? understanding entire process dies because ends allocating memory , causing fragmentation. tried separating threads via appdomains + calling gc forcefully nothing changed.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -