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 <rep...@bugs.python.org> <http://bugs.python.org/issue25554> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com