Memory leak problem

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
mman2112
Prole
Posts: 5
Joined: Fri Jun 08, 2012 7:33 pm

Memory leak problem

Post by mman2112 »

I made a small demo program and I've noticed the longer the program runs the more RAM it uses, I left it alone for a while and it reached 2.5Gb of memory usage. I link below a copy of the program with the fps reduced to 5 to slow the effects, if anyone can solve this problem that would be greatly appreciated.
(note: move the mouse left and right to see what the program does)
Image_test_01.love
memory leak
(10.89 KiB) Downloaded 117 times
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Memory leak problem

Post by Boolsheet »

love.graphics.newScreenshot and love.graphics.newImage are not designed for streaming. Calling them every update/draw is extremely inefficient.

Code: Select all

function love.draw()
    -- ...
    screen = love.graphics.newScreenshot()
    screen = love.graphics.newImage(screen)
end
You can force a garbage collection with collectgarbage to clean up the unused ImageData and Image immediately.
Shallow indentations.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 0 guests