I am running an Ubuntu 16.04.1 LTS machine with Python 3.5.2 which has about 40 Python scripts loaded, each one of which uses Requests. I recently updated Requests and suddenly found I was running out of memory.
Upon further investigation I discovered that as of version 2.12.0, the idna package has been included in requests and this has caused the memory consumption for each script to increase by about 20MB.
This can be observed with the following steps:
- Install Requests version 2.11.1
- Run
python3 -c "import requests; import time; time.sleep(60)" &.
- While the previous command is running, run
top or htop and observe the resident memory usage of the command.
- Install Requests version 2.12.0.
- Repeat steps 2 and 3.
Is there any way that Requests could lazily load the idna library so that this extra 20MB of memory is only used when actually working with IDNA domains?
I am running an Ubuntu 16.04.1 LTS machine with Python 3.5.2 which has about 40 Python scripts loaded, each one of which uses Requests. I recently updated Requests and suddenly found I was running out of memory.
Upon further investigation I discovered that as of version 2.12.0, the
idnapackage has been included in requests and this has caused the memory consumption for each script to increase by about 20MB.This can be observed with the following steps:
python3 -c "import requests; import time; time.sleep(60)" &.toporhtopand observe the resident memory usage of the command.Is there any way that Requests could lazily load the idna library so that this extra 20MB of memory is only used when actually working with IDNA domains?