openweather/out of memory

Here we can discuss about the problem found
Post Reply
Stuart
Posts: 126
Joined: Fri Feb 19, 2021 7:46 pm
Has thanked: 5 times
Been thanked: 20 times

openweather/out of memory

Post by Stuart »

I'm getting 'out of memory' errors a second or so after a request to the openweather api. The api returns a long string, but nothing like the size of the memory hit I'm seeing (> 60k). The ram reports as 89604 bytes when the request is submitted, but rapidly declines until it fails. This is the program diagnostic wlog at the time:

[13:00:00] openweather requested ram:89604
[13:00:00] MCP23017 read portA 11110110 ram:77512
[13:00:00] 11110110 ram:77484
[13:00:00] UFH on ram:28420
[13:00:00] CH on ram:30528
[13:00:01] go:55.625 ram:30060
Out of memory line 417

The action on receipt of the incoming message is below, but it isn't clear that the incoming message has been received, so I'm guessing that it is the receipt of the incoming message that is the cause. It is a central heating supervisory system to control the boiler temperature according to the weather. I'm re-engineering a ten year old Picaxe system for ESP32/Annex.

b$=wgetresult$
ext_temp=val(JSON$(b$,"main.temp"))
b$ = ""
timestamp "openweather temperature in Christleton:"+str$(ext_temp)
return

It seems to happen each time I access openweather (in principle hourly), except the first time when the program initialises. The rest of the code is well exercised so I'm fairly sure it is something to do with the api.

I could revert to the local measured temperature but it is convenient to save a sensor for another purpose.

I'm using 1.43.3 and an ESP32. I chose .3 as the safe option after I found other problems with .5, .6 and .7. 1.43.4 is also attractive as I'm a lInux user for preference, I could use that if it was later code.

Any ideas to reduce the memory hit of the openweather api?

Stuart
User avatar
cicciocb
Site Admin
Posts: 1900
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1271 times
Contact:

Re: openweather/out of memory

Post by cicciocb »

Hi Stuart,
does your request is https?
In fact this kind of request consumes a lot of RAM.

Maybe you could try to do the same using a simple http (that should work with the openweather.api

Another option could be to use a module with PSRAM
Stuart
Posts: 126
Joined: Fri Feb 19, 2021 7:46 pm
Has thanked: 5 times
Been thanked: 20 times

Re: openweather/out of memory

Post by Stuart »

yes it was port 443. 60k extra does seem excessive! I can try port 80.

thanks

Stuart
Post Reply