-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
response.text() memory consumption is too high #183
Comments
@psitem just checking that you are using the most recent version of Requests. Also the tricky thing is even though you have 3x the available memory, it may be fragmented and so you don't have a continuous block of 32763. When I'm pulling down big files, i have strategically placed |
I've been through the process of adding This is all based on the |
And |
I'm not set up to run a debugger on this so I can't observe whether it's from the |
I too am seeing too much memory consumed by response.text (latest version here) with large responses. In addition,
when completed. More importantly, I don't think |
Getting the following exception:
memory allocation failed, allocating 32763 bytes
I have a bit more than 3X memory free at the time of making the call to response.text().
Adafruit_CircuitPython_Requests/adafruit_requests.py
Line 327 in c567e1d
What I've found is that each pass through the
iter_content
loop is consuming 2Xchunk_size
(so 2X the content in total) and then at theself.close()
another allocation happens for the full content size, where it throws the exception. Unclear to me if that's coming from.close
or from the.join
incontent
:Adafruit_CircuitPython_Requests/adafruit_requests.py
Line 292 in c567e1d
I've found that increasing the
chunk_size
to 64 gets me working at a cost of 2.5Xchunk_size
per pass through theiter_content
loop (but half as many passes).Adafruit_CircuitPython_Requests/adafruit_requests.py
Line 327 in c567e1d
First observed on
Adafruit CircuitPython 8.2.10 on 2024-02-14; Raspberry Pi Pico W with rp2040
Also reproduced on
Adafruit CircuitPython 9.0.2 on 2024-03-28; Raspberry Pi Pico W with rp2040
The text was updated successfully, but these errors were encountered: