Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5460

MicroPython • Viability of Pico W as a network device

$
0
0
I am wondering just how viable a Pico W is as a web or wireless server. This is from my trivial web server ...

Code:

11:29:37 :    Shrink : 52% Used       -------- +++++++        Free 48%   76 KB11:29:37 :             23% Used           ---- +++++++++++    Free 77%  122 KB11:29:37 :    Waiting for connection11:29:59 :    Connection from 192.168.0.205 port 5025311:30:00 :    Handle request11:30:00 :      HTTP_GET /11:30:00 :    Shrink : 39% Used         ------ +++++++++      Free 61%   95 KB11:30:00 :             23% Used           ---- +++++++++++    Free 77%  120 KB11:30:00 :    Creating reply11:30:00 :    Sent reply11:30:00 :    Shrink : 93% Used -------------- +              Free  7%   12 KB11:30:00 :             29% Used          ----- ++++++++++     Free 71%  112 KB11:30:00 :    Waiting for connection
The 'Shrink' are calls to garbage collection, showing before and after results. The surprise for me was that I have 120 KB free (77%) when I start formulating a reply but just 12 KB free (7%) once that reply has been sent.

This was a fairly simple reply and inevitably more complex ones crash and burn with out of memory.

I am not doing anything too complex in my code that I can see, but can perhaps rewrite to be more memory efficient. And I can throw more garbage collection in there - which seems to be the approach most have taken as they frantically try to get things to work.

I would like to get it to work, am prepared to start digging into how things work, where memory is being used, finding alternative approaches, because I can't see any reason a MicroPython web server shouldn't be able to serve up a 1 MB file.

But am I on a hiding to nowhere ?

What are other people's opinions and experiences of using a Pico W in anger ?

Statistics: Posted by hippy — Sat Jan 13, 2024 11:54 am



Viewing all articles
Browse latest Browse all 5460

Trending Articles