[Tutor] How to log process handles and GDI objects in python

Pai, Yogesh M Yogesh.M.Pai at tektronix.com
Mon Feb 11 05:25:02 CET 2013

Hi Alan,

Here are the additional details:
Python version: 2.7.3
OS version: Windows 7 -64 bit

I have an application that has a automation layer built in python. During every subsequent runs, I want to log the process threads and GDI objects ( the one you see in the Windows task manager) in my python code- The idea is to use this data to generate a plot to check if the application leaks memory in a long run. Although I can use a third-party app to log this, is it possible to import certain library in python and log these windows attributes during the execution?


-----Original Message-----
From: Tutor [mailto:tutor-bounces+yogesh.m.pai=tektronix.com at python.org] On Behalf Of Alan Gauld
Sent: Friday, February 08, 2013 5:02 PM
To: tutor at python.org
Subject: Re: [Tutor] How to log process handles and GDI objects in python

On 08/02/13 09:06, Pai, Yogesh M wrote:

> I would like to know how can I log system process handles and GDI 
> objects for debugging memory leak issues in python.

This isn't really a question about learning Python so probably would be better on the main Python mailing list.

However it will help if you specify things like the OS, the Python version. Also be clear about what exactly you mean by process handles and GDI objects. I'm guessing you are talking about Windows but I can't be sure.

> I would like to log these inside a loop (stress test) to check if my 
> application leaks handles and plot them later for my usage.

I imagine that means you are creating a test lop that creates and releases these handles? How do you get a handle? can you store it as a variable? can you print it? can you create a string and print that?

Sorry I can't be of more help but that's a fairly open question about a very specific problem.

Alan G
Author of the Learn to Program web site

Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:

More information about the Tutor mailing list