Answer the question
In order to leave comments, you need to log in
Why does an application on the corona SDK clog RAM?
Why does an application on the corona SDK clog RAM?
main.lua code:
function update(e)
display.newRect(w/2, h/2, w, h):setFillColor(0,0,0,1);
display.newText(os.date('*t').sec, w/2, h/2);
end;
Runtime:addEventListener( "enterFrame", update );
Answer the question
In order to leave comments, you need to log in
Corona does not work like love2d and other lower level engines.
display.newRect() is not about painting the framebuffer region with a certain color, it is about creating an object in memory that will draw itself every frame without the need for the update(enterFrame) function.
enterFrame is needed to update already created objects, and not to create new ones every frame. Therefore, the RAM is clogged.
local rect = display.newRect(w/2, h/2, w, h)
rect:setFillColor(0,0,0,1)
local label = display.newText('', w/2, h/2)
local function update(e)
label.text = os.date('*t').sec
end
Runtime:addEventListener( "enterFrame", update );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question