Memory allocation failure for large json get request #14147
Unanswered
AgentK88
asked this question in
RP2040 / Pico
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a program that calls 3 APIs on an hourly process. Everything works the first execution but on the second I get the below error
Initial free: 83776 allocated: 108160
GETing API trend data
Traceback (most recent call last):
File "", line 80, in
File "apiRequestTrend.py", line 34, in requestTrend
File "apiRequestTrend.py", line 28, in get_trend_data
File "requests/init.py", line 33, in json
File "requests/init.py", line 20, in content
MemoryError: memory allocation failed, allocating 19456 bytes
I suspect that this is due to heap fragmentation as the response from apiRequestTrend can be quite large as you can see.
Is there a way to re-use a buffer in a urequests.get(url) call?
Code below
Beta Was this translation helpful? Give feedback.
All reactions