This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2016年03月28日 20:07 by Kevin Modzelewski, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg262582 - (view) | Author: Kevin Modzelewski (Kevin Modzelewski) | Date: 2016年03月28日 20:07 | |
The slice type doesn't participate in GC, which means that if you happen to create a cycle involving a slice, that cycle will never get freed. Here's an example: def f(): l = [] l.append(slice(l)) # Will consume memory without bound: while True: f() This seems pretty hard to trigger accidentally, so it might not be a huge deal -- especially since it seems to have been around for a while. (I only checked 2.7 and trunk though.) I think this could be solved by either having the slice class participate in GC (ie add tp_traverse and tp_clear methods), or maybe doing some type-filtering during slice_new(). |
|||
| msg262589 - (view) | Author: Philip Dubé (Demur Rumed) * | Date: 2016年03月29日 03:50 | |
Implementing tp_traverse & tp_clear seems to runs into complications due to slice_cache |
|||
| msg263590 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2016年04月16日 21:54 | |
New changeset 879da9400529 by Benjamin Peterson in branch '2.7': add gc support to slice (closes #26659) https://hg.python.org/cpython/rev/879da9400529 New changeset 9e2176d18965 by Benjamin Peterson in branch '3.5': add gc support to slice (closes #26659) https://hg.python.org/cpython/rev/9e2176d18965 New changeset 870fcc50f1bd by Benjamin Peterson in branch 'default': merge 3.5 (#26659) https://hg.python.org/cpython/rev/870fcc50f1bd |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:29 | admin | set | github: 70846 |
| 2016年04月16日 22:52:29 | martin.panter | set | versions: + Python 3.5 |
| 2016年04月16日 21:54:40 | python-dev | set | status: open -> closed nosy: + python-dev messages: + msg263590 resolution: fixed stage: resolved |
| 2016年03月29日 22:18:46 | vstinner | set | nosy:
+ vstinner |
| 2016年03月29日 08:16:06 | SilentGhost | set | nosy:
+ georg.brandl, pitrou, benjamin.peterson, yselivanov |
| 2016年03月29日 03:50:32 | Demur Rumed | set | nosy:
+ Demur Rumed messages: + msg262589 |
| 2016年03月28日 20:07:30 | Kevin Modzelewski | create | |