-->
Page 2 of 12

Re: Massive memory optimization: flash functions! (+SPI SSD1

PostPosted: Sun Mar 08, 2015 4:27 pm
by dpwhittaker
What about:

Code: Select all  wifi.sta.getap(function(t)
               config.ListAP(t)
               collectgarbage()
               end)


The collect inside the function doesn't do much, because it can't collect the running function... Maybe you are just not collecting at the right time.

If that doesn't work, I'll try it myself when I get in from church tonight.

Re: Massive memory optimization: flash functions! (+SPI SSD1

PostPosted: Sun Mar 08, 2015 4:58 pm
by Patriko
Still nothing :(
Even after running collectgarbage("collect") after a second, two or more it doesn't free the memory. Only restarting device allow to free some memory.

I'd be thankful if you'd find a way how to solve it :)

Patriko

Re: Massive memory optimization: flash functions! (+SPI SSD1

PostPosted: Sun Mar 08, 2015 11:54 pm
by dpwhittaker
I read through the nodemcu source and discovered the issue. They don't release the reference to your function after they call it. I think this is a bug, but there is a way to make it happen. Switch back to your original method:

Code: Select allconfig = require "config"
config.ConfigModule()
wifi.sta.getap(config.ListAP)


But in config.ListAP, add this anywhere:

Code: Select allwifi.sta.getap(nil)


I still haven't had a chance to test it myself, but it looks like it will help.

Re: Massive memory optimization: flash functions! (+SPI SSD1

PostPosted: Tue Mar 10, 2015 4:48 am
by sevic71
Hi people,
i just try to follow your logic in order to test 'flashed functions' approach with my own scripts, but can't catch where function config.ConfigModule() comes from. It is not implemented within flash module 'config' listed above. I'm confused...