Skip to content

idna package increases memory usage by ~20MB #3780

@DanielGibbsNZ

Description

@DanielGibbsNZ

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:

  1. Install Requests version 2.11.1
  2. Run python3 -c "import requests; import time; time.sleep(60)" &.
  3. While the previous command is running, run top or htop and observe the resident memory usage of the command.
  4. Install Requests version 2.12.0.
  5. 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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions