[issue38251] urllib.request memory leak / overflow

2019-09-22 Thread Ofer Sadan


New submission from Ofer Sadan :

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



[issue38251] urllib.request memory leak / overflow

2019-09-22 Thread Ofer Sadan


Ofer Sadan  added the comment:

Just to note: I'm using Python 3.7.4 on Windows 10 (64bit), the issue exists on 
both the 32bit/64bit python versions I could test on.

--

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



[issue38251] urllib.request memory leak / overflow

2019-09-23 Thread Ofer Sadan


Ofer Sadan  added the comment:

I can confirm that testing with http instead of https this problem doesn't 
exist, on 3.7.4.

Are the issues closed because this problem is fixed in the upcoming 3.7.5, or 
3.8.0?

--

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



[issue38251] urllib.request memory leak / overflow

2019-09-23 Thread Ofer Sadan


Ofer Sadan  added the comment:

I appreciate the suggestion and the update, thank you!

--

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