Author: fijal
Branch:
Changeset: r93770:d655e2839a95
Date: 2018-02-06 14:38 +0100
http://bitbucket.org/pypy/pypy/changeset/d655e2839a95/
Log: cleanup
diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -35,7 +35,7 @@
except ImportError:
assert '__pypy__' not in sys.builtin_module_names
newlist_hint = lambda sizehint: []
- add_memory_pressure = lambda size, obj: None
+ add_memory_pressure = lambda size: None
if sys.version_info[0] >= 3:
StandardError = Exception
@@ -155,7 +155,7 @@
# backed by :memory: or a file)
res = factory(database, timeout, detect_types, isolation_level,
check_same_thread, factory, cached_statements)
- add_memory_pressure(100 * 1024, res)
+ add_memory_pressure(100 * 1024)
return res
diff --git a/pypy/module/__pypy__/interp_magic.py
b/pypy/module/__pypy__/interp_magic.py
--- a/pypy/module/__pypy__/interp_magic.py
+++ b/pypy/module/__pypy__/interp_magic.py
@@ -142,14 +142,11 @@
space.newbool(debug))
@unwrap_spec(estimate=int)
-def add_memory_pressure(space, estimate, w_obj=None):
+def add_memory_pressure(space, estimate):
""" Add memory pressure of estimate bytes. Useful when calling a C function
that internally allocates a big chunk of memory. This instructs the GC to
garbage collect sooner than it would otherwise."""
- #if space.is_none(w_obj):
rgc.add_memory_pressure(estimate)
- #else:
- # rgc.add_memory_pressure(estimate, w_obj)
@unwrap_spec(w_frame=PyFrame)
def locals_to_fast(space, w_frame):
diff --git a/rpython/rlib/rzlib.py b/rpython/rlib/rzlib.py
--- a/rpython/rlib/rzlib.py
+++ b/rpython/rlib/rzlib.py
@@ -269,6 +269,7 @@
compress data.
"""
stream = lltype.malloc(z_stream, flavor='raw', zero=True)
+ rgc.add_memory_pressure(rffi.sizeof(stream))
err = _deflateInit2(stream, level, method, wbits, memLevel, strategy)
if err == Z_OK:
if zdict is not None:
@@ -303,6 +304,7 @@
decompress data.
"""
stream = lltype.malloc(z_stream, flavor='raw', zero=True)
+ rgc.add_memory_pressure(rffi.sizeof(z_stream))
err = _inflateInit2(stream, wbits)
if err == Z_OK:
if zdict is not None and wbits < 0:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit