[pypy-issue] Issue #2881: List strategies: switching to object can create more memory pressure than expected (pypy/pypy)

Armin Rigo issues-reply at bitbucket.org
Tue Sep 4 06:51:22 EDT 2018


New issue 2881: List strategies: switching to object can create more memory pressure than expected
https://bitbucket.org/pypy/pypy/issues/2881/list-strategies-switching-to-object-can

Armin Rigo:

Here's a case where memory pressure increases much more than naively expected:

```
#! python

lst = [0] * (10**8)
lst[0] = 'X!'
```

That's because the switch to the object strategy will create 100 million new copies of the object ``0``, whereas on CPython the list contains 100 million references to the same object ``0``.




More information about the pypy-issue mailing list