Possible uasyncio write improvment #10043
Unanswered
git-n-pissed
asked this question in
Libraries & Drivers
Replies: 1 comment
-
There is an outstanding PR #7868 for this issue. |
Beta Was this translation helpful? Give feedback.
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I have some code running on an ESP8266 which was based on an old commit of MicroPython (8f55a8f) which did not contain uasyncio. I rebased my code the other day on (ac5934c) and updated it to use the included uasyncio. Unfortunately I found that picoweb kept crashing due to a memory error on the last line of
usayncio.stream.write
. The current implementation:The problem with this is that the
=+
causes a copy ofbuf
to be made even ifself.out_buf
is already empty. This makes sense in cases where a developer desires to callwrite
multiple times beforedrain
, but in cases wheredrain
is immediately called afterwrite
, the RAM used by the actual data inbuf
ends up being double what it needs to be. This is especially evident whenawrite
/stream_awrite
is used, because it does calldrain
immediately after callingwrite
. The following change fixed my problem and I believe prevents the described issue.Beta Was this translation helpful? Give feedback.
All reactions