1

I have a python(3.6.5) package that creates multiple objects. The main process seems to have a memory leak based on what I see in task scheduler as well as a bail out criteria that I have put in place if memory every exceeds 1GB. Code for detecting memory bloat is as follows:

        from win32con import PROCESS_QUERY_INFORMATION, PROCESS_VM_READ
        from win32api import OpenProcess
        from win32process import GetProcessMemoryInfo
        handle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, os.getpid())
        process_memory = int(GetProcessMemoryInfo(handle)['WorkingSetSize'])

I tried using tracemalloc to detect the memory bloat by putting a break point at the point at which this bail out criteria is hit and the total memory usage that tracemalloc detects is just over 300MB. If I don't create these objects the bloat is not observed(Tested with commenting out code where objects are created). What is the best way to debug this memory leak for the remaining 700MB of memory usage?

Thanks

NightFury
  • 19
  • 3

0 Answers0