WHEN I ALWAYS RESTART MY GAME .. WHY IT'S SO LAG?

.

WHEN I ALWAYS RESTART MY GAME … WHY IT’S SO LAG?

.

.

WHAY SHOULD I DO?

WHEN I IMPLEMENT INTO MY PHONE …

FIRST ITS WORKS FINE…

.

WHEN I ALWAYS RESTART MY GAME OR 10X TO RESTART.

ITS STARTING TO LAG…

.

I THINK ITS MEMORY PROBLEM…

I SUSPECT YOU’VE GOT MEMORY LEAKS.

You’ll need to painstakingly step through your code, making sure you’re freeing up allocated memory accordingly.

@SegaBoy: I LOVE YOUR ANSWER! :smiley:

@ juario_soul: Are you removing and niling out your display objects properly? :wink:

i dont think so…

    group:insert( background )
    group:insert( bio )
    group:insert( rcyble)
    group:insert( top )
    group:insert(timeLeft)
    group:insert(timeLeft1)
    group:insert(score)
    group:insert(text1)
    group:insert(meters)
    group:insert(pu1)
    group:insert(pu2)
    group:insert(pu3)
    group:insert(green)
    group:insert(black)
 

function scene:exitScene( event )
    local group = self.view
        physics.stop()
    Runtime:removeEventListener(“touch”, rcyble)
    Runtime:removeEventListener(“touch”, bio)
    Runtime:removeEventListener(“accelerometer”, acc)
    Runtime:removeEventListener( “collision”, green )
    Runtime:removeEventListener( “collision”, black )
    Runtime:removeEventListener( “accelerometer”, accback )

local backgroundMusicChannel = audio.pause( bgMusic, { channel=4, loops=1000, fadein=3000 })

end

.

.

@CineTek

its not a proper removing object ser?

try put this to see if there is memory leaking

local printMemUsage = function()  

    local memUsed = (collectgarbage(“count”))

    local texUsed = system.getInfo( “textureMemoryUsed” ) / 1048576 – Reported in Bytes

   print("\n---------MEMORY USAGE INFORMATION---------")

   print(“System Memory: “, string.format(”%.00f”, memUsed), “KB”)

   print(“Texture Memory:”, string.format("%.03f", texUsed), “MB”)

   print("------------------------------------------\n")

end

– Only load memory monitor if running in simulator

if (system.getInfo(“environment”) == “simulator”) then

    Runtime:addEventListener( “enterFrame”, printMemUsage)

end

how can i know if theres a memory leaking ser?

if the Texture Memory becoming high?

WHEN I IMPLEMENT INTO MY PHONE …

FIRST ITS WORKS FINE…

.

WHEN I ALWAYS RESTART MY GAME OR 10X TO RESTART.

ITS STARTING TO LAG…

.

I THINK ITS MEMORY PROBLEM…

I SUSPECT YOU’VE GOT MEMORY LEAKS.

You’ll need to painstakingly step through your code, making sure you’re freeing up allocated memory accordingly.

@SegaBoy: I LOVE YOUR ANSWER! :smiley:

@ juario_soul: Are you removing and niling out your display objects properly? :wink:

i dont think so…

    group:insert( background )
    group:insert( bio )
    group:insert( rcyble)
    group:insert( top )
    group:insert(timeLeft)
    group:insert(timeLeft1)
    group:insert(score)
    group:insert(text1)
    group:insert(meters)
    group:insert(pu1)
    group:insert(pu2)
    group:insert(pu3)
    group:insert(green)
    group:insert(black)
 

function scene:exitScene( event )
    local group = self.view
        physics.stop()
    Runtime:removeEventListener(“touch”, rcyble)
    Runtime:removeEventListener(“touch”, bio)
    Runtime:removeEventListener(“accelerometer”, acc)
    Runtime:removeEventListener( “collision”, green )
    Runtime:removeEventListener( “collision”, black )
    Runtime:removeEventListener( “accelerometer”, accback )

local backgroundMusicChannel = audio.pause( bgMusic, { channel=4, loops=1000, fadein=3000 })

end

.

.

@CineTek

its not a proper removing object ser?

try put this to see if there is memory leaking

local printMemUsage = function()  

    local memUsed = (collectgarbage(“count”))

    local texUsed = system.getInfo( “textureMemoryUsed” ) / 1048576 – Reported in Bytes

   print("\n---------MEMORY USAGE INFORMATION---------")

   print(“System Memory: “, string.format(”%.00f”, memUsed), “KB”)

   print(“Texture Memory:”, string.format("%.03f", texUsed), “MB”)

   print("------------------------------------------\n")

end

– Only load memory monitor if running in simulator

if (system.getInfo(“environment”) == “simulator”) then

    Runtime:addEventListener( “enterFrame”, printMemUsage)

end

how can i know if theres a memory leaking ser?

if the Texture Memory becoming high?