[issue25554] memory leak (reference cycles) using re

Serhiy Storchaka report at bugs.python.org
Thu Nov 5 05:31:24 EST 2015


Serhiy Storchaka added the comment:

Thank you for your report and patch Jeroen.

Indeed, there is a regression, and your patch fixes it. But I don't like the idea of using weakref. For now sre_parse has very little dependencies, but weakref depends on collections that depends on a number of modules. For now importing weakref works, but it is too easy to create a dependency loop in future.

Here is alternative patch that gets rid of references at all. The subpatterns list was added in the patch for issue9179 and is an implementation detail. We can replace it with a list of subpattern widths.

----------
assignee:  -> serhiy.storchaka
components: +Regular Expressions
nosy: +ezio.melotti, mrabarnett, serhiy.storchaka
stage:  -> patch review
versions: +Python 2.7, Python 3.4, Python 3.6
Added file: http://bugs.python.org/file40952/fix_mem_sre_parse_2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25554>
_______________________________________


More information about the Python-bugs-list mailing list