Python3.6.6 's requests library sends https requests, which causes memory leaks and win10,ubuntu16.04.

python3.6.6 "s requests library sends https requests, and memory leaks occur in win10,ubuntu16.04

. I asked on

stackoverflow,github, but no one answered. I also had this problem in the official version of Python before 3.6.1. Now I have fixed
, but I will still encounter

.

the code is as follows:

import requests
while 1:
    with requests.get("https://www.baidu.com") as r:
        text = r.text
        

the versions of each library are as follows:

{
  "chardet": {
    "version": "3.0.4"
  },
  "cryptography": {
    "version": "2.3.1"
  },
  "idna": {
    "version": "2.7"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.6.6"
  },
  "platform": {
    "release": "10",
    "system": "Windows"
  },
  "pyOpenSSL": {
    "openssl_version": "1010009f",
    "version": "18.0.0"
  },
  "requests": {
    "version": "2.19.1"
  },
  "system_ssl": {
    "version": "100020ff"
  },
  "urllib3": {
    "version": "1.23"
  },
  "using_pyopenssl": true
}

using task manager in win10 and top-p in ubuntu can see the memory continues to grow.
I have used gc,objgraph to debug, but I can"t find the reason. Ask for advice!


have you solved it


excuse me, how did you solve it in the end? I have the same problem

Menu