windll event loop leaks

Robin Becker robin at jessikat.fsnet.co.uk
Thu Nov 14 08:06:54 EST 2002


In article <smy4xrpv.fsf at python.net>, Thomas Heller <theller at python.net>
writes
.......
>
>Sounds like a leak in calldll?
>
>So the only advice is to build a debug version and run it with a
>debugging build of Python to either use
>
I also suspected the calldll stuff, but when I try just a simple looping
pair eg

from dynwin import windll

testdll = windll.module('testdll')

print 'start',
for i in xrange(1000000):
        testdll.setrecord(i)
        testdll.getrecord()
print 'finished'

then I don't see any memory leakage. This dll is one of my old
tcldllcaller things and so uses standard C linkage.

/*testdll*/
int record=0
int     getrecord(void)
{
        return record;
}
void    setrecord(int i)
{
        record = i;
}


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.

>- the (undoumented) sys.getobjects() function to find leaking objects.
>- or step through calldll's code with the MSVC debugger.
>
>You should be able to find some messages on python-dev were Tim Peters
>explains what getobjects() does.

Thanks for that.

>
>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
:) 

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

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



More information about the Python-list mailing list