[Tutor] Any way of monitoring a python program's memory utilization?

Terry Carroll carroll at tjc.com
Thu Jul 17 03:19:12 CEST 2008

On Wed, 16 Jul 2008, Terry Carroll wrote:

> The obvious thing to do is to also filter by PID, which is the second 
> element; Of course that opens a new question: how to find one's own PID 
> from within Python.  More googling awaits.....

And, while searching for that, I found out hwo to find memory utilization.  
For those who care:

def memusage():
    import win32process
    current_process = win32process.GetCurrentProcess()
    memory_info = win32process.GetProcessMemoryInfo(current_process)
    return memory_info["WorkingSetSize"]

More information about the Tutor mailing list