DataDog/dd-agent — pull request #698 by conorbranagan (2013-10-22 23:54:43+00:00)
Title: Fix a memory leak in the Window Agent

There is a _slow_ memory leak in the Agent that appears to be caused by relative imports of the WMI class and instantiating a WMI class on every check run. There is a test to check that memory isn't leaking in the Windows system checks.

I've eliminated the relative imports and fixed up all the checks so that they only create one WMI connection per host/port/username. In nearly all cases, it will be None for all three values because we're just querying the local host.

I believe this will fix #586 which, upon further investigation, was caused by the Agent taking up ~350MB and the WMI checks were failing with the following error:

```python
2013-10-20 22:03:59,466 | ERROR | checks.iis(__init__.pyc:454) | Check 'iis' instance #0 failed
Traceback (most recent call last):
File "checks\__init__.pyc", line 445, in run
File "C:\Program Files\Datadog\Datadog Agent\files\..\checks.d\iis.py", line 54, in check
File "wmi.pyc", line 1290, in connect
File "wmi.pyc", line 241, in handle_com_error
x_wmi:
2013-10-2
```