New submission from Ofer Sadan <ofersada...@gmail.com>:

running `urllib.request.urlopen` multiple times causes the memory usage to 
increase with each run, even after calling `close()` on the request or using 
`del` on the result

To recreate this problem, run code:

    import urllib.request
    def ip():
        r = urllib.request.urlopen('https://api.ipify.org')
        b = r.read()
        r.close()
        print(len(b))
        return b

    for i in range(1000):
        result = ip()
        del result

Even though `len(b)` has a maximum value of 15 (for this url at least), the 
memory increases with each run by 200KB - 1MB

----------
components: Library (Lib)
messages: 352968
nosy: Ofer Sadan
priority: normal
severity: normal
status: open
title: urllib.request memory leak / overflow
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38251>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to