Heap not released
Posted: Sun Jan 31, 2016 11:36 am
Hi,
I'm trying to read temperature and pressure from BMP180 sensor with my ESP8266. I want to display those numbers on 128x64 screen. BMP180 works perfectly, and I have also managed to write display driver. However, when I put those two pieces together I get "Run out of memory" exception.
According to my research, I should be able to release heap used by BMP180 library with following commands:
So I tried the following code:
But the result is:
The collectgarbage() method doesn't help either. So why am I still missing 6000 bytes? Am I doing anything wrong? Is there another way to clear my heap?
Thanks for help
I'm trying to read temperature and pressure from BMP180 sensor with my ESP8266. I want to display those numbers on 128x64 screen. BMP180 works perfectly, and I have also managed to write display driver. However, when I put those two pieces together I get "Run out of memory" exception.
According to my research, I should be able to release heap used by BMP180 library with following commands:
Code: Select all
bmp180 = nil
package.loaded["bmp180"]=nil
So I tried the following code:
Code: Select all
print("start "..node.heap())
bmp180 = require("bmp180")
bmp180.init(I2C_SDA, I2C_SCL)
bmp180.read(OSS)
t = bmp180.getTemperature()
p = bmp180.getPressure()
print("finished "..node.heap())
bmp180 = nil
package.loaded["bmp180"]=nil
print("unloaded "..node.heap())
But the result is:
Code: Select all
start 26752
finished 20424
unloaded 20376
The collectgarbage() method doesn't help either. So why am I still missing 6000 bytes? Am I doing anything wrong? Is there another way to clear my heap?
Thanks for help