Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r91646:fd92a8bc06b6
Date: 2017-06-25 11:43 +0200
http://bitbucket.org/pypy/pypy/changeset/fd92a8bc06b6/
Log: Issue #2579
First approach to fix a "leak" in _lzma.py
diff --git a/lib_pypy/_lzma.py b/lib_pypy/_lzma.py
--- a/lib_pypy/_lzma.py
+++ b/lib_pypy/_lzma.py
@@ -10,6 +10,7 @@
import weakref
import sys
import io
+import __pypy__
from _lzma_cffi import ffi, lib as m
@@ -688,6 +689,16 @@
self.lock = threading.Lock()
self.flushed = 0
self.lzs = _new_lzma_stream()
+ # Issue #2579:
+ # Setting up the stream for encoding takes around 17MB of RAM
+ # on my Linux 64 system. That's potentially too much to sanely
+ # leave it to the GC: in case we're compressing a large number
+ # of small files, the following line puts a big pressure on the
+ # major collections. Still better than without it, where it
+ # would allocate huge amount of RAMs before doing any collection.
+ # Ideally we should do something more clever like reusing old
+ # streams after we're finished with them.
+ __pypy__.add_memory_pressure(1024*1024*17)
if format == FORMAT_XZ:
if filters is None:
if check == -1:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit