A simple test:
- Restart ESP
- Print a string
- Check memory
- Set a s string to "test"
- Check memory
- Print s string
- Check memory
- Set the same string to nil
- Check memory
RESULT: Memory lost!
node.restart()
> "ʃ
æÿ[0C]G9ÿQˆBIb õ[11]™RClò)û
lua: cannot open init.lua
NodeMcu 0.9.2 build 20141129 powered by Lua 5.1.4
> print(node.heap())
21408
> print("test")
test
> print(node.heap())
21408
> -- No memory used
> s = "test"
> print(node.heap())
21128
> print(s)
test
> print(node.heap())
21128
> s = nil
> print(node.heap())
21224
> -- 5 minutes later
> print(node.heap())
21224
> -- Why? What happened to the (21408 - 21224 = 184 bytes)?
This effect is worse the larger the element. If I did the same thing with a largish function and then set the function and all it's variables to nil, the lost memory is even greater.
Thoughts?