Why after hide (minimize) the window the memory used of program is reduced?
example.py:
import time
while True:
a = 2*2
a = 0
time.sleep(0.1)
after run in cmd (Windows XP, Python 2.7.9), used memory in task manager = 4 384 KB. after minimize console window used memory = 1 544 KB
Why is this happening? How to fix memory without hide window?
UPD: Solution: http://blog.in-orde.nl/content/memory-leak-using-com-objects-python-and-how-fix-it
SetProcessWorkingSetSize.import ctypes;kernel32 = ctypes.WinDLL('kernel32');kernel32.GetCurrentProcess.restype = ctypes.c_void_p;kernel32.SetProcessWorkingSetSize.argtypes = (ctypes.c_void_p, ctypes.c_size_t, ctypes.c_size_t);kernel32.SetProcessWorkingSetSize(kernel32.GetCurrentProcess(), -1, -1).