So, I wrote a WPF application that takes in all sorts of data from a database, then using Code Synethesis it writes XML files based off of the data. The problem is, sometimes after it finishes writing, the application just seems to hang there, with the Windows Cursors.Wait icon and if I click in the application it freezes up completely and I have to Close Process on the application from Task Manager.

Looking at a completed XML document (*.xml), its about 100MB to 200MB (including tags and everything), depending on the type of data. Is it possible that the garbage collection is the reason why the application seems to be busy for so long? Sometimes it sits for +30mins and it'll eventually resolve, but no idea why.

有帮助吗?

解决方案

Garbage collection will not be the reason for this. GC can easily collect millions of objects per second, and most likely you don't have that many sitting around.

If you can repeat this while debugging inside Visual Studio, hit Break All to break execution. Then, use the Threads tool window (Ctrl+D,T) to check all running threads, and switch to each one to see where it is waiting. If you GUI is frozen, it may likely be the inside the Main Thread (GUI thread).

Most likely, you have a deadlock of some sort, and your app is waiting to acquire a lock.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top