So I noticed my game was slowly eating up more and more memory and couldn't find out why!
I decided to learn about garbage collection by creating a new, simple love2d project with the following code:
main.lua:
Code: Select all
function love.load()
end
function love.update()
end
function love.draw()
love.graphics.setColor(255, 255, 255, 255)
love.graphics.rectangle("fill", 10, 10, 100, 100)
end
When I run this simple program, the amount of memory displayed in 'Task Manager.exe' slowly increases from around 12 to 4 KB every second until it reaches a peak amount of memory ~22,100 KB to ~22,208 KB
That doesn't seem so bad but when you have 1000's of rectangles being rendered at any given time this adds up, and in my main project I haven't been able to see any peak memory usage as it just keeps rising by a few MB per second.
My Question
Is this normal? Are there any steps I'm missing to preventing memory rising like this?
Thanks in advance!