Collection Factory is leaking references (DEF-2596) (SOLVED)

I was testing on mobile and it started to jitter and lag.
Profiler shows, with collection factories, Lua.refs kept increasing and so does memory.

To reproduce:

local pos = vmath.vector3(0, 0, 0)
function update(self, dt)
   -- Simple collection with single, empty game object
    local id = collectionfactory.create("#collectionfactory", pos)
    go.delete_all(id)
    
    -- Creating the same object with factory do not leak memory
    --local id = factory.create("#factory", pos)
    --go.delete(id)
end

Game Object factory does not have this problem.

1 Like

I’m unable to reproduce this issue. What does the collection consist of? Please describe the game objects, their hierarchy and all components attached to them (maybe screenshot the Outline window).

The game object has no components.
The collection only has the object

Should I add you in the project?

master.zip (2.1 MB)
Project files

Output

2 Likes

Ha! Super strange. I used the web profiler, and unless I also have the visual profiler active, it won’t report Lua.Refs and Lua.Mem in the web profiler. @Mathias_Westerdahl just confirmed that this is a bug that will get fixed in the next release.

The actual issue with the memory leak has been reported as DEF-2596. Thank you so much for reporting this!

6 Likes

Solved in 1.2.129