[Patches] [ python-Patches-1643874 ] ctypes leaks memory
SourceForge.net
noreply at sourceforge.net
Thu Jan 25 20:24:41 CET 2007
Patches item #1643874, was opened at 2007-01-24 22:12
Message generated for change (Comment added) made by theller
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1643874&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Thomas Heller (theller)
Assigned to: Thomas Heller (theller)
Summary: ctypes leaks memory
Initial Comment:
This program leaks memory, because a string is allocated with the win32 call SysAllocString(), but SysFreeString() is never called.
"""
from ctypes import oledll, _SimpleCData
class BSTR(_SimpleCData):
_type_ = "X"
func = oledll.oleaut32.SysStringLen
func.argtypes = (BSTR,)
while 1:
func("abcdefghijk")
"""
The attached patch fixes this.
(The BSTR data type is not exposed by ctypes or ctypes.wintypes, because it is only used in connection with Windows COM objects.)
The patch should be applied to release25-maint and trunk.
----------------------------------------------------------------------
>Comment By: Thomas Heller (theller)
Date: 2007-01-25 20:24
Message:
Logged In: YES
user_id=11105
Originator: YES
Fixed in r53556, r53557 (trunk) and r53558 (release25-maint).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1643874&group_id=5470
More information about the Patches
mailing list