A customer had some code that called
FreeLibrary
,
and they expected the library to be freed,
but it wasn't happening.
They suspect that there was an unmatched
call to LoadLibrary
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 unloads,
and you can use
the
!avrf -dlls
debugger extension to view that log.
For each module that is loaded and unloaded,
it records a stack trace of the LoadLibrary
and
FreeLibrary
.
The customer reported back that this debugger extension
found the problem.
Their code used the
HKEY_
PERFORMANCE_
DATA
registry key to read some performance counters,
and opening the performance counter
was triggering an additional DLL load.