Author: Justin Peel <notmuchtot...@gmail.com> Branch: Changeset: r47308:1d95dfe42b4f Date: 2011-09-16 14:05 -0600 http://bitbucket.org/pypy/pypy/changeset/1d95dfe42b4f/
Log: pyexpat memory leak fixed by using a weakref. diff --git a/pypy/module/pyexpat/interp_pyexpat.py b/pypy/module/pyexpat/interp_pyexpat.py --- a/pypy/module/pyexpat/interp_pyexpat.py +++ b/pypy/module/pyexpat/interp_pyexpat.py @@ -12,6 +12,7 @@ from pypy.translator.platform import platform import sys +import weakref import py if sys.platform == "win32": @@ -164,7 +165,7 @@ if id < 0: id = global_storage.next_id global_storage.next_id += 1 - global_storage.storage[id] = obj + global_storage.storage[id] = weakref.ref(obj) return id @staticmethod @@ -255,7 +256,7 @@ src = py.code.Source(""" def %(name)s_callback(%(first_arg)s, %(args)s): id = rffi.cast(lltype.Signed, %(ll_id)s) - userdata = global_storage.get_object(id) + userdata = global_storage.get_object(id)() space = userdata.space parser = userdata.parser @@ -290,7 +291,7 @@ # and it's not modifiable via user code anyway def UnknownEncodingHandlerData_callback(ll_userdata, name, info): id = rffi.cast(lltype.Signed, ll_userdata) - userdata = global_storage.get_object(id) + userdata = global_storage.get_object(id)() space = userdata.space parser = userdata.parser _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit