It seems pretty trivial to put love in a state where the garbage alloc never stabilizes. Take this code:
Code: Select all
local time = 0
local text = {
garbage = love.graphics.newText(love.graphics.getFont(), ''),
time = love.graphics.newText(love.graphics.getFont(), ''),
}
function love.update(dt)
time = time + dt
local gc_alloc = string.format("gc_alloc: %0.2f KB", collectgarbage('count'))
text.garbage:set(gc_alloc)
-- Enabling this line prevents gc count from stabilizing!
--~ text.time:set(time)
if love.keyboard.isDown("escape") then
love.event.quit()
end
end
function love.draw()
love.graphics.draw(text.garbage, 60,535)
love.graphics.draw(text.time, 60,435)
end
function love.quit()
print('time:', time)
end
I want to see how big the effect of pooling some objects have on gc usage, but I can't just print gc count since it's constantly increasing from factors outside my control.