Memory Validator provides functionality to detect memory leaks and resource leaks in 32 and 64 bit programs running on Windows NT® 4.0 and above.
Memory leaks (allocations without a corresponding deallocation) are detected in the following:
Functions
•new •malloc •calloc •realloc •_expand •LocalAlloc •LocalRealloc •GlobalAlloc •GlobalRealloc |
•HeapAlloc •HeapReAlloc •VirtualAlloc •VirtualAllocEx •IMalloc •CoTaskMemAlloc •CoTaskMemReAlloc •SysAllocString |
•NetApi function group
•Miscellaneous other memory allocation functions
COM objects
•COM leaks
User defined
•User defined heaps (requires linking with svlMemoryValidatorStubLib.lib / svlMemoryValidatorStubLib_x64.lib to access this functionality)
•User defined reference counted objects (requires linking as above)
•Reference counting for user managed heaps.
•Memory leaks from user managed heaps.
Potentials
•Potentially unused memory.
•Potentially leaked memory.
Learn more about memory management on Windows at the MSDN Dev Center.
Resource leaks are detected - typically handles that are not closed.
Memory usage errors are typically the result of passing the wrong pointer to a deallocation or reallocation function, or attempting to deallocate memory more than once.
Examples detected include:
•Incorrect memory freeing - e.g. freeing a pointer not allocated from the appropriate heap
•Allocate with malloc() - then deallocate with delete or delete []
•Allocate with calloc() - then deallocate with delete or delete []
•Reallocate with realloc() or _expand() - then deallocate with delete or delete []
•Allocate with new - then deallocate with free()
•Allocate with new - then reallocate with realloc() or _expand()
•Multiple memory freeing - e.g. freeing the same pointer more than once
•Heap overruns - writing past the end of an allocated heap block
•Heap underruns - writing past the start of an allocated block
•Heap corruption - heap getting damaged by heap overruns, heap underruns and wild pointer writes
•Stack overruns - writing past the end of the current stack frame
•Stack underruns - writing past the start of the current stack frame
•Uninitialized data in C++ objects.
•Detection of C++ objects that do not initialise all their member variables.
Memory Validator can hook AddRef(), Release() and QueryInterface() so that it can track the reference counts for COM objects.
Memory Validator uses the .Net ICorProfiler and ICorProfilerCallback interfaces to monitor .Net applications.