I've got an application for testing fabricated products using some legacy code in an dll. The application could be set up for different products. The setup is done via xml-files and can (and will) be changed during runtime, i.e. at End-Of-Lot. The processing of the xml is done by the mentioned legacy dll.

After running over a longer time (days to weeks) I've noticed an increasing memory footprint. Debugging into that, I could trace the (possible) leak to the dll. After getting the source, I could further investigate till I found something like this:

CAObjHandle doc;
MSXML6_NewDOMDocument40IXMLDOMDocument2(0, 0, LOCALE_NEUTRAL, 0, &doc);
[...]
MSXML6_IXMLDOMDocument2load(doc, 0, vtPath, &success);

It seems to me, this is called every time, a new lot is started. And it's this doc structure, that seems to reside in memory. I don't find any place where it is freed.

After all, the dll had a lot of minor leaks, all from not freed objects (of CVI-functions). I fixed those, but I don't know, how to free this MS-Objects. I came across this: Understanding the MSXML garbage collection mechanism, but after I have ANSI-C code, I'm not sure, what to do with GC and wether it works or not.

Is there a way, to free MSXML-Objects manually?

有帮助吗?

解决方案

Okay, found the answer. A MSXML6_* object could be deallocated with CA_DiscardObjHandle().

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