[New-bugs-announce] [issue25554] memory leak (reference cycles) using re
Jeroen van der Heijden
report at bugs.python.org
Thu Nov 5 03:27:44 EST 2015
New submission from Jeroen van der Heijden:
When compiling a regular expression with groups (subpatterns),
circular references are created.
Here is an example to illustrate the problem:
>>> import gc
>>> import re
>>> gc.disable() # disable garbage collector
>>> gc.collect() # make sure we start with 0
0
>>> re.compile('(a|b)') # compile something with groups
re.compile('(a|b)')
>>> gc.collect() # collects x objects depending on the compiled string
11
To fix the issue a weakref object for p is used.
----------
components: Library (Lib)
files: fix_mem_sre_parse.patch
keywords: patch
messages: 254092
nosy: joente
priority: normal
severity: normal
status: open
title: memory leak (reference cycles) using re
type: resource usage
versions: Python 3.5
Added file: http://bugs.python.org/file40948/fix_mem_sre_parse.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25554>
_______________________________________
More information about the New-bugs-announce
mailing list