In my game engine, I show the Vector and Color objects for Lua using userdata.
Now, for every even locally generated vector and color from Lua scripts, Luas memory usage is slightly increased, it does not drop until the garbage collector is started.
The garbage collector calls up a small bench in my game.
Shouldn't you remove Vector and Color objects right away if they are used only as arguments? For example, for example:myObject:SetPosition( Vector( 123,456 ) )
They're not right now - Lua memory usage increases to 1.5 MB per second, then the lag drops, and it goes back to about 50 KB.
- How can I solve this problem, is it even solvable?
source
share