开发者

How to track down COM memory leak

I'm trying to track down a memory leak in a COM object, and I'm not seeing anything obviously wrong. I'm probably using some of the COM wrappers incorrectly, but my standard toolkit of finding memory leaks (AQtime) isn't helping me with COM. Does anyone have any tricks/tools to track down COM memory/r开发者_Python百科eference leaks?


If you're using ATL you can define _ATL_DEBUG_INTERFACES (see MSDN entry). This will certainly help you to catch any leaked interfaces, although obviously it won't help to catch any resources leaked internally within the object.


Check if the COM object(s) get released completely. Usually, AddRef+Release return the current reference count for debug purposes (you shouldn't rely on that for production code).

Otherwise, just general advice: reduce the code involved - do you get the leak whwen you just create and release the instance? After a certain method call?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜