[python-win32] win32api.GetShortPathName() leaks memory?

Patrick Li patrick at raptr.com
Sat May 17 21:58:38 CEST 2008


Hi,

I'm running into some memory leak issue when running the
win32pi.GetShortPathName function.  Basically I've got a daemon that will
perform this function on lots of long windows path names.  Over time, it
looks like the memory footprint increases substantially.

You can reproduce it by simply launching this in your python interpreter:

import win32api

for x in xrange(1000000):
  win32api.GetShortPathName("c:\\documents and settings\\some
directory\\name")

You will see in your windows task manager that the memory usage shoots up.

Anyone have any idea on how to get around this problem?  I thought about
writing my own version of GetShortPathName, but so far I haven't been able
to find any source code/docs online on the proper logic to generate the
short name.

Thanks,
Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20080517/675036ce/attachment.htm>


More information about the python-win32 mailing list