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.
[.14.21] Not all memory freed after find_ent_filtered
Re: [.14.21] Not all memory freed after find_ent_filtered
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.
If you want to get ahold of me I'm almost always on Discord.
Re: [.14.21] Not all memory freed after find_ent_filtered
Awesome, Thank you for the detailed reply!