-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory not released after dofile. #495
Comments
That's one of the feature of Lua... |
@MarsTechHAN local port = loadfile("xmlparser.lc")("netconfig.xml", "port") There are all sorts of mechanisms for leakage. You need to supply an independently repeatable test case. |
@TerryE This is an example written in our wiki page:
The output was:
This itself leaks the memory! |
@saitejalakkimsetty, I am not sure that this is a bug. There was a known issue with the for i = 1, 20 do dofile('temp1.lua') collectgarbage() print (node.heap()) end and this showed a steady loss in memory, then this would be a true leak. Have a look at my Unofficial nodeMCU FAQ on the esp8266.com site for more discussion. |
@TerryE Thanks Terry. I removed the code inside the listap function into a separate file and called it. I was able to save all the memory except 400 bytes. |
@TerryE Thanks for your correction, I'm not a qualified Lua programer😁 TODO: @MarsTechHAN |
Temporary fiix has arrived, but still consumes around 200 bytes. The fix is similar to moving the code from callback function into a dofile, and then calling the dofile through the function. They both consume exactly same amount of ram. |
Hello. I am new to lua and NodeMCU. I dont know if you can classify this as a issue, but there they are.
I am trying to extract data from an xml file.
Here is my xml file:
Here is my xmlparser:
I call this file using:
local port = dofile("xmlparser.lc")("netconfig.xml", "port")
And this same thing happens over there too, where I try to create a xml file for the scanned WiFi networks.
I call this file using:
dofile("apscan.lc")
I always endup with memory less than I started with (sometimes as high as 5kb) even though I call the garbagecollector. Moreover The heap seems to decrease further if the word I am searching for is near the end of file. I also observed that if the word I am looking for is not present, the heap has the less difference I started with.
The text was updated successfully, but these errors were encountered: