[pypy-commit] pypy default: pyexpat memory leak fixed by using a weakref.
justinpeel
noreply at buildbot.pypy.org
Fri Sep 16 22:05:39 CEST 2011
Author: Justin Peel <notmuchtotell at 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
More information about the pypy-commit
mailing list