title: Memory leak while running WMI query to Win32_PageFileUsage class on Server 2008 SP2
body: <p>Running WMI query against Win32_PageFileUsage class causes a memory leak. In my situation it is being done to 200 servers every 5 minutes. After about 3 hours the memory leak is nearly 10 GB. I think it is somehow relaited to that fact, that the pagefile does not exist. The value is "0". Here is my code:</p>
  
  <pre><code>...
  ObjectQuery pageFileUsageQuery = 
          new ObjectQuery("SELECT AllocatedBaseSize, CurrentUsage FROM Win32_PageFileUsage");
  m_PageFileUsageSearcher = new ManagementObjectSearcher(managementScope, pageFileUsageQuery);
  ...
  var pageFileUsageCollection = m_PageFileUsageSearcher.Get();
  double currentUsage = 0;
  double maxSize = 0;
  
  foreach (ManagementBaseObject managementBaseObject in pageFileUsageCollection)
  {
          string result = managementBaseObject["CurrentUsage"].ToString();
          currentUsage += double.Parse(result);
  }
  </code></pre>
  
  <p>The system is Windows Server 2008 SP2. Maybe somebody has any ideas?</p>