[issue27535] Ignored ResourceWarning warnings leak memory in warnings registries

Serhiy Storchaka report at bugs.python.org
Tue Nov 21 11:08:14 EST 2017


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

> While I don't see how we can avoid "leaking memory" (growing the registry) for actions like "once", I think that it's ok to don't touch the registry for the "ignore" action. So at least, an application ignoring ResourceWarning will not leak anymore.

This is a caching for speed. If the same line of code emits the same warning, it is enough to tests the registry and don't apply all warning filters.

I think we should find better compromise between performance if all messages equal and memory usage if all messages are different. Since caching for the "ignore" action affects only performance, not semantic, we could check whether there are too much warnings for the "ignore" action are cached in the same line. The problem is how to make this effectively. And what is "too much".

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue27535>
_______________________________________


More information about the Python-bugs-list mailing list