windll event loop leaks

Thomas Heller theller at python.net
Thu Nov 14 08:40:35 EST 2002


> >Sounds like a leak in calldll?
> >
> One thought that occurs is that the system API linkage might be
> different. Any thoughts on that? If that were the case I would assume
> leakage in the stack.

Just did a quick test with a system function with __stdcall linkage,
and this doesn't seem to have problems:

from dynwin import windll
kernel32 = windll.module("kernel32")
while 1:
    kernel32.GetModuleHandle(0)
    
> >
> >Another approach ;-) would be to give up calldll/windll and try the
> >ctypes module - this way you would have me debugging the thing (in
> >case it leaks).
> >
> >Thomas
> Well it's only a few days old according to the announcement I just found
> :) 

The announcement and the distribution is only a few days old, ctypes
is much older, and in active use for quite some time (by me).
OTOH, I wouldn't be too surprised if there are stiill bugs in it.

> 
> I will certainly give this a whirl. It doesn't provide a callback
> generatr, but I suppose I can still use Sam's gencb.

Sure does it! It's just not yet documented, although I believe
there are examples in the test directory.

Paul Moore posted even a nice example for a callback here
http://aspn.activestate.com/ASPN/Mail/Message/python-list/1425385

> 
> Does ctypes use the FFI library for accessing external DLLs? That way it
> would map to other platforms fairly easily.

No. It uses very old code of mine to call these functions,
but I'm already looking into more portable ways to do it.

Anthony Green's libffi is my favorite currently.

Thomas



More information about the Python-list mailing list