[issue25554] memory leak (reference cycles) using re

2015-11-05 Thread Jeroen van der Heijden

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



[issue25554] memory leak (reference cycles) using re

2015-11-05 Thread Jeroen van der Heijden

Jeroen van der Heijden added the comment:

Thanks Serhiy,

I totally agree with your solution. Using a list with subpattern widths is 
definitely better compared to using weakref.

--

___
Python tracker 
<http://bugs.python.org/issue25554>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25566] asyncio reference cycles after ConnectionResetError

2015-11-06 Thread Jeroen van der Heijden

New submission from Jeroen van der Heijden:

When a ConnectionResetError occurs, reference cycles are created due to 
__traceback__. As far as I can see there's no way to prevent this to happen 
since the event loop exception handler is not called for the following events: 
BrokenPipeError, ConnectionResetError and ConnectionAbortedError. 
(selector_events.py, line 579)

In this case the connection is probably lost so '_protocol.connection_lost()' 
will not be called either. (at least we can't rely on this)

Maybe it's possible to just call the exception handler? Or, in case we want to 
ignore these errors set __traceback__ to None?

--
components: asyncio
messages: 254184
nosy: gvanrossum, haypo, joente, yselivanov
priority: normal
severity: normal
status: open
title: asyncio reference cycles after ConnectionResetError
type: resource usage
versions: Python 3.5

___
Python tracker 
<http://bugs.python.org/issue25566>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com