Tracking Memory Leaks in Outlook 2007
So I noticed that My outlook.exe process was growing at a rate of roughly 1mb each time I open an email composing window. This is the same outlook I am running my addin on, so that is probably the cause.
I've been through the code and everything, and there is nothing terribly obvious I can spot that I haven't released the resource of. Does anyone have a utility or methodology to hel开发者_运维知识库p me track them down?
Unfortunately there isn't really a utility for this, if you do a GC.Collect() twice, and the memory drops down, you have an issue around the mismatch between the memory models of the COM world and the managed world.
I have found that it pays off to release your COM objects deterministically with the use of Marshal.ReleaseComObject.
It is quite a complex subject, I have written an in depth blog post on the subject, available http://jake.ginnivan.net/vsto-com-interop
I would suggest the ANTS memory profiler. It can track your add-in, as per this post: https://red-gate.com/messageboard/viewtopic.php?t=4753
精彩评论