Retrieving node information in WMI causes memory leaks

New Contributor



Inquiry Summary
Retrieving node information in WMI causes memory leaks

Execution Environment
  Microsoft Windows Server 2016 Datacenter
  10.0.14393 N/A build 14393
  Multiprocessor Free

Application Build Environment
  Microsoft Windows Server 2012 R2 Standard
 Microsoft Visual Studio Professional 2015 Version 14.0.25420.01 Update 3
 Visual C++ 2015 00322-50052-73614-AA667

A module created in VC++ has a daemon that gets the node information in WMI.
This module is experiencing a memory leak.

I created a test program to get the values of VirtualSize and WorkingSetSize repeatedly with reference to the following site
The test program also showed a memory leak when I created

Below are the results of 20,000 attempts.
VirtualSize is 7340032 bytes, 702,728,736 bytes increase.
----- ...
0 wmitest.exe VirtualSize:57511936 WorkingSetSize:6836224
1 wmitest.exe VirtualSize:57511936 WorkingSetSize:7028736
2 wmitest.exe VirtualSize:57511936 WorkingSetSize:7036928
3 wmitest.exe VirtualSize:57511936 WorkingSetSize:7041024
4 wmitest.exe VirtualSize:57511936 WorkingSetSize:7041024
5 wmitest.exe VirtualSize:57511936 WorkingSetSize:7041024
6 wmitest.exe VirtualSize:57511936 WorkingSetSize:7045120
7 wmitest.exe VirtualSize:57511936 WorkingSetSize:7045120
8 wmitest.exe VirtualSize:57511936 WorkingSetSize:7045120
9 wmitest.exe VirtualSize:57511936 WorkingSetSize:7045120

1022 wmitest.exe VirtualSize:57511936 WorkingSetSize:7770112
1023 wmitest.exe VirtualSize:57511936 WorkingSetSize:7770112
1024 wmitest.exe VirtualSize:58560512 WorkingSetSize:7831552
1025 wmitest.exe VirtualSize:58560512 WorkingSetSize:7847936
2798 wmitest.exe VirtualSize:58560512 WorkingSetSize:8470528
2799 wmitest.exe VirtualSize:58560512 WorkingSetSize:8536064
2800 wmitest.exe VirtualSize:60657664 WorkingSetSize:8650752
2801 wmitest.exe VirtualSize:60657664 WorkingSetSize:8654848
9242 wmitest.exe VirtualSize:60657664 WorkingSetSize:10366976
9243 wmitest.exe VirtualSize:60657664 WorkingSetSize:10375168
9244 wmitest.exe VirtualSize:64851968 WorkingSetSize:10653696
9245 wmitest.exe VirtualSize:64851968 WorkingSetSize:10665984
19997 wmitest.exe VirtualSize:64851968 WorkingSetSize:13864960
19998 wmitest.exe VirtualSize:64851968 WorkingSetSize:13864960
19999 wmitest.exe VirtualSize:64851968 WorkingSetSize:13864960

(1) Are there workarounds, bug information, HotFix, etc. for the above?

(2) Is there anything I can do to help determine the cause of the problem?


0 Replies