Lazy loading problem

Hi guys,

I have a new game almost ready to go on the market.

Game works great in Corona Simulator.

Game works great on iPhone 4S.

I do not have any memory leaks.

Problem is that game crashes on iPad mini 2.

Game crashes only when you hit “restart Btn” after gameOver.

It does not crash when you hit “backBtn” after gameOver, and then proceed to level of your choice.

I suspect that problem is in to fast resources unloading / loading.

I am using around 100-117 Mb of Texture memory maximum on iPad mini 2, and about 1.2Mb of video memory.

When you hit restart you basically go to dummy plain tryagain.lua, and then proceed back to your starting level.

Do you have any idea how to solve this?

If I use all Sprites as global ones, then I would have an opposite problem, i.e memory leak?

Many thanks!  :slight_smile:

Ivan

Cab you post your code for your restart button?

Thanks!

Hi Sonic,

It is a simple code:

if(event.target.id == “restartBtn”) then
composer.goto(tryagain, options)
end

AND THEN IN TRYAGAIN.LUA show:scene() :

if (previousScene == “level1”) then
composer.goto(“level1”, options)
elseif(…)
– other levels here…
end

I do not think code is the problem, I think I’ve put too much texture memory, so real devices trigger memory warnings (peaks).
App in Corona Simulator works great, also on iPhone 4S, but on iPad crashes on restart.

Sorry for not formating above code (I am in a bus on a cellphone) :slight_smile:

I can confirm now that the problem was in “peak” memory.

Now when I am at 70Mb maximum, game does not crash.

Do you know how to test .app on iOs Simulator?

Because when I build directly from Corona, and check “run in iOs Simulator”, that does not work… iOs Simulator does not run my app.

Cab you post your code for your restart button?

Thanks!

Hi Sonic,

It is a simple code:

if(event.target.id == “restartBtn”) then
composer.goto(tryagain, options)
end

AND THEN IN TRYAGAIN.LUA show:scene() :

if (previousScene == “level1”) then
composer.goto(“level1”, options)
elseif(…)
– other levels here…
end

I do not think code is the problem, I think I’ve put too much texture memory, so real devices trigger memory warnings (peaks).
App in Corona Simulator works great, also on iPhone 4S, but on iPad crashes on restart.

Sorry for not formating above code (I am in a bus on a cellphone) :slight_smile:

I can confirm now that the problem was in “peak” memory.

Now when I am at 70Mb maximum, game does not crash.

Do you know how to test .app on iOs Simulator?

Because when I build directly from Corona, and check “run in iOs Simulator”, that does not work… iOs Simulator does not run my app.