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:
- 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).
- how see 49k handles ? processexplorer shows 5k items - rest of them?
- 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
Post a Comment