I am developing a COM dll which is CoCreateInstanced by a program.
When vld exits, it calls waitForAllVLDThreads from which WiatForSingleObject is called for each thread in m_tlsMap. In normal cases, it returns WAIT_OBJECT_0.
However, if that program is also injected with an external dll for logging purpose,
WaitForSingleObject always returns WAIT_TIMEOUT.
vld tries it for at most 9 threads (for 90 seconds) before returning from waitForAllVLDThreads.
//--------------------------------
[log from Output window]
//--------------------------------
Visual Leak Detector: Waiting for threads to terminate...
Visual Leak Detector: Waiting for threads to terminate...
Visual Leak Detector: Waiting for threads to terminate...
Visual Leak Detector: Waiting for threads to terminate...
Visual Leak Detector: Waiting for threads to terminate...
Visual Leak Detector: Waiting for threads to terminate...
Visual Leak Detector: Waiting for threads to terminate...
No memory leaks detected.
WARNING: Visual Leak Detector: Some threads appear to have not terminated normally.
This could cause inaccurate leak detection results, including false positives.
Visual Leak Detector is now exiting.
//--------------------------------
There are two cases depening on the availability of the external dll's source code.
[case 1] external dll's source available
Adding the following line into the external dll's source file will solve this issue. I don't know why, though.
#include <vld.h>
But, isn't there any way to avoid this issue without adding vld.h to the external dll's source file?
[case 2] external dll's source not available
How can this issue be resolved?
[P.S] In the next issue report (See https://vld.codeplex.com/workitem/10573), I posted another issue raised when using vld for a program with an external dll injected.
When vld exits, it calls waitForAllVLDThreads from which WiatForSingleObject is called for each thread in m_tlsMap. In normal cases, it returns WAIT_OBJECT_0.
However, if that program is also injected with an external dll for logging purpose,
WaitForSingleObject always returns WAIT_TIMEOUT.
vld tries it for at most 9 threads (for 90 seconds) before returning from waitForAllVLDThreads.
//--------------------------------
[log from Output window]
//--------------------------------
Visual Leak Detector: Waiting for threads to terminate...
Visual Leak Detector: Waiting for threads to terminate...
Visual Leak Detector: Waiting for threads to terminate...
Visual Leak Detector: Waiting for threads to terminate...
Visual Leak Detector: Waiting for threads to terminate...
Visual Leak Detector: Waiting for threads to terminate...
Visual Leak Detector: Waiting for threads to terminate...
No memory leaks detected.
WARNING: Visual Leak Detector: Some threads appear to have not terminated normally.
This could cause inaccurate leak detection results, including false positives.
Visual Leak Detector is now exiting.
//--------------------------------
There are two cases depening on the availability of the external dll's source code.
[case 1] external dll's source available
Adding the following line into the external dll's source file will solve this issue. I don't know why, though.
#include <vld.h>
But, isn't there any way to avoid this issue without adding vld.h to the external dll's source file?
[case 2] external dll's source not available
How can this issue be resolved?
[P.S] In the next issue report (See https://vld.codeplex.com/workitem/10573), I posted another issue raised when using vld for a program with an external dll injected.