New submission from Thomas Heller <thel...@ctypes.org>:

This little script 'ctypes-leak.py' leaks memory:

"""
import gc
from ctypes import *

PROTO = WINFUNCTYPE(None)

class Test(object):
    def func(self):
        pass

    def __init__(self):
        self.v = PROTO(self.func)


while 1:
    try:
        Test()
        gc.collect()
    except KeyboardInterrupt:
        print len([x for x in gc.get_objects()
                   if isinstance(x, Test)])
"""

The cause is that patch related to issue #2682; it leaks since rev. 62481 (in 
trunk) and rev. 62484 (in py3k).

I have not yet been able to find the cause of the leak.

----------
assignee: theller
components: ctypes
files: ctypes-leak.py
messages: 99527
nosy: theller
severity: normal
status: open
title: ctypes memory leak
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file16253/ctypes-leak.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7959>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to