Created
October 22, 2013 22:01
-
-
Save conorbranagan/7108965 to your computer and use it in GitHub Desktop.
Debugging windows agent memory leak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
log = logging.getLogger(__file__) | |
import checks.system.win32 as w32 | |
WIN32_CHECKS = [ | |
w32.Disk(log), | |
w32.IO(log), | |
w32.Processes(log), | |
w32.Memory(log), | |
w32.Network(log), | |
w32.Cpu(log) | |
] | |
AGENT_CONFIG = {} | |
class TestWin32(unittest.TestCase): | |
def testMemory(self): | |
import gc | |
gc.set_debug(gc.DEBUG_LEAK) | |
try: | |
start = len(gc.garbage) | |
for check_klass in WIN32_CHECKS: | |
metrics = check_klass.check(AGENT_CONFIG) | |
end = len(gc.garbage) | |
self.assertEquals(end - start, 0, gc.garbage) | |
finally: | |
gc.set_debug(0) | |
if __name__ == "__main__": | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment