Page 1 of 1

[.14.21] Not all memory freed after find_ent_filtered

Posted: Fri Jan 06, 2017 12:28 pm
by Nexela
Not sure if a bug or just cache related so move accordingly

It seems some of the memory from find_entities_filtered is not cleaned up after freeing everything

On a map with 5,287,977 Decorations
checked by using collectgarbage("count")*1024

Lua memory before loop
136,055 Lua Mem before iterating entities -- This is Expected
for _, decoration in pairs(game.surfaces[1].find_entities_filtered{type="decorative"}) do end
4,366,265,239 (4GB) Lua Memory After looping decorations --This is expected at least until .15 :)
469,876,647 (.5GB) After forcing Garbage Collection collectgarbage("collect") -- Not expected should be lower?, Also will not go any lower no matter how much time passes.
Saving (which now takes longer) and reloading the map brings both the system memory and Lua memory back to same levels as when started.

Re: [.14.21] Not all memory freed after find_ent_filtered

Posted: Fri Jan 06, 2017 1:53 pm
by Rseding91
It's expected. The memory gets fragmented when you do that many operations. I've looked at it myself and it's not leaking anything in the sense that something is allocated and not deallocated through our code.

Re: [.14.21] Not all memory freed after find_ent_filtered

Posted: Fri Jan 06, 2017 2:18 pm
by Nexela
Awesome, Thank you for the detailed reply!