开发者

FileSystemWatcher and System Out of Memory Exception

A little context

There is a wpf based application which i left opened for 2-3 days without performing any activity throws out of memory exception , this is very Weird situation and does not happen all of the time. During this ideal activity , my application does nt perform any activity but just a file system watcher contineously watching a shared location , so i thought that would be a problem but i am not sure. Any suggesti开发者_如何学Goon is always welcomed.


Are you adding something to a list\collection when a FileSystemWatcher event happens? You could be doing this directly, or more possibly indirectly if it is non-obvious.

This could eventually lead to OOM and would be dependant on how many events there had been, so the time taken to reach OOM could be highly variable.

FileSystemWatcher on its own will not lead OOM. It maintains an internal buffer, but it will overwrite the buffer if file system event data is not taken via FSW events quickly enough.

So no, the FileSystemWatcher will not lead to OOM on its own - the internal buffer mechanism removes this possibility by design.


windbg (the debugger from Debugger Tools for Windows, included in the Windows SDK. itself included with VS these days) includes a command to dump statistics on the managed heap. Including what kind of types are allocated. This should help identify what objects are not being collected (probably via some reference that should be been cleared).

This should get you started: http://blogs.msdn.com/b/tess/archive/2005/11/25/496973.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜