hamishcunningham / fishy-wifi

Scripts, notes and the odd subaquatic gizmo for the ESP8266 and what-have-you.
GNU Affero General Public License v3.0
25 stars 13 forks source link

memory leak #4

Closed DrRob closed 9 years ago

DrRob commented 9 years ago

Hello,

I'm very new to Lua so I may be being stupid, but:

I'm running nodemcu on an esp8266, with a DHT22 for temperature/humidity and a TSL2561 for light levels. I grabbed a copy of your TSL2561 library (thanks!), but I found I couldn't run that and the DHT22 code, because the esp8266 ran out of heap when require()-ing the second lib.

I tried setting the variable that I'd loaded your lib into to nil, and package.loaded["lux"] = nil, and then also package.loaded["tsl2561lib"] = nil and package.loaded["i2cutils"] = nil as well, but still a lot of heap space wasn't being returned.

So then I altered your library to use local variables wherever possible, and that seems to have solved the problem.

Is this a valid change, or am I missing something? (Probably I am...)

Thanks, Rob.

Aeprox commented 9 years ago

I ran into the same problem. I did the same thing as you and altered the code in a trial-and-error manner untill the memory requirements went down enough for it to run. I managed to get the same setup as you running using an altered version of this code. Source available on github.com/Aeprox/ESPLogger

I could create a pull request if needed

hamishcunningham commented 9 years ago

I've accepted the pull request -- thanks! h

On 10 June 2015 at 17:53, Michael Lucas notifications@github.com wrote:

I ran into the same problem. I did the same thing as you and altered the code in a trial-and-error manner untill the memory requirements went down enough for it to run. I managed to get the same setup as you running using an altered version of this code. Source available on github.com/Aeprox/ESPLogger

I could create a pull request if needed

— Reply to this email directly or view it on GitHub https://github.com/hamishcunningham/fishy-wifi/issues/4#issuecomment-110831709 .

Hamish Cunningham Professor of Computer Science, University of Sheffield, UK +44 7920 765 455 https://twitter.com/@HCunningham hamish@gate.ac.uk https://pi.gate.ac.uk https://hamish.gate.ac.uk https://gate.ac.uk

DrRob commented 9 years ago

Thanks, both.