A customer had some code that called
and they expected the library to be freed,
but it wasn't happening.
They suspect that there was an unmatched
and was wondering if there were any diagnostic
tools that would help them find it.
Application Verifier to the rescue.
Application Verifier maintains a history of module loads
and you can use
debugger extension to view that log.
For each module that is loaded and unloaded,
it records a stack trace of the
The customer reported back that this debugger extension
found the problem.
Their code used the
registry key to read some performance counters,
and opening the performance counter
was triggering an additional DLL load.