issue with clear level object?

Hi,

I almost finish my game and I’m currently debugging my levels (I have 50 levels) using the Corona simulator and my phone.

My game Is based on the composer API.

I have an issue I see only on my Android Phone (not in simulator).

Sometimes objects of one level (random level) are not deleted as expected and they affect the new level. It seems they are exist behind the new level background.

I can run days without seeing this problem.

I verify that I’m removing all the Timers,  Display, Text and Sound objects from the scene.

I verify (in the simulator) that I don’t have memory leaks.

Any ideas of how can I fix it or debug it?

Regards,

Guy

Did you verify that you are adding all display objects the each scenes group?

Hi JonPM

Yes, i added all the display objects to the scenes group.
Some of my display object are divided into different display groups and i have a function to add all the groups to the scenes group

function setupDisplay (sceneGroup)
 sceneGroup:insert (boxDisplay);
 sceneGroup:insert (frontBoxDisplay);
 sceneGroup:insert (ballGroup);
 sceneGroup:insert (textDisplay);
 sceneGroup:insert (redBoxBallCoun);
 sceneGroup:insert (blueBoxBallCoun);
 sceneGroup:insert (greenBoxBallCoun);
 sceneGroup:insert (yellowBoxBallCoun);
 frontBoxDisplay:toFront();
 return sceneGroup
end

I also have a function to clear al the display groups, just to make sure.

for example

function clearGameDisplay ()

 for i=ballGroup.numChildren,1,-1 do
     display.remove( ballGroup[i] ) ; ballGroup[i] = nil
 end
 for i=textDisplay.numChildren,1,-1 do
     display.remove( textDisplay[i] ) ; textDisplay[i] = nil
 end

 for i=redBoxBallCoun.numChildren,1,-1 do
     display.remove( redBoxBallCoun[i] ) ; redBoxBallCoun[i] = nil
 end
 for i=blueBoxBallCoun.numChildren,1,-1 do
     display.remove( blueBoxBallCoun[i] ) ; blueBoxBallCoun[i] = nil
 end
 for i=greenBoxBallCoun.numChildren,1,-1 do
     display.remove( greenBoxBallCoun[i] ) ; greenBoxBallCoun[i] = nil
 end
 for i=yellowBoxBallCoun.numChildren,1,-1 do
     display.remove( yellowBoxBallCoun[i] ) ; yellowBoxBallCoun[i] = nil
 end

end

function clearBoxDisplay ()
 for i=frontBoxDisplay.numChildren,1,-1 do
     display.remove(frontBoxDisplay[i] ) ; frontBoxDisplay[i] = nil
 end
 for i=boxDisplay.numChildren,1,-1 do
     display.remove( boxDisplay[i] ) ; boxDisplay[i] = nil
 end
end

regards,

Guy

Hi ,

I did not resolve this issue yet.

I noticed that the problem occurs more frequently when I update a new version of a game on my phone.

When I clear the phone cache memory I rarely see the problem or not at all.

I need to clean the cache after I install the new game version, clearing the memory after deleting the old game memory and before installing the new version is not giving the same results.

Does it make senses?

Regards,

Guy

Did you verify that you are adding all display objects the each scenes group?

Hi JonPM

Yes, i added all the display objects to the scenes group.
Some of my display object are divided into different display groups and i have a function to add all the groups to the scenes group

function setupDisplay (sceneGroup)
 sceneGroup:insert (boxDisplay);
 sceneGroup:insert (frontBoxDisplay);
 sceneGroup:insert (ballGroup);
 sceneGroup:insert (textDisplay);
 sceneGroup:insert (redBoxBallCoun);
 sceneGroup:insert (blueBoxBallCoun);
 sceneGroup:insert (greenBoxBallCoun);
 sceneGroup:insert (yellowBoxBallCoun);
 frontBoxDisplay:toFront();
 return sceneGroup
end

I also have a function to clear al the display groups, just to make sure.

for example

function clearGameDisplay ()

 for i=ballGroup.numChildren,1,-1 do
     display.remove( ballGroup[i] ) ; ballGroup[i] = nil
 end
 for i=textDisplay.numChildren,1,-1 do
     display.remove( textDisplay[i] ) ; textDisplay[i] = nil
 end

 for i=redBoxBallCoun.numChildren,1,-1 do
     display.remove( redBoxBallCoun[i] ) ; redBoxBallCoun[i] = nil
 end
 for i=blueBoxBallCoun.numChildren,1,-1 do
     display.remove( blueBoxBallCoun[i] ) ; blueBoxBallCoun[i] = nil
 end
 for i=greenBoxBallCoun.numChildren,1,-1 do
     display.remove( greenBoxBallCoun[i] ) ; greenBoxBallCoun[i] = nil
 end
 for i=yellowBoxBallCoun.numChildren,1,-1 do
     display.remove( yellowBoxBallCoun[i] ) ; yellowBoxBallCoun[i] = nil
 end

end

function clearBoxDisplay ()
 for i=frontBoxDisplay.numChildren,1,-1 do
     display.remove(frontBoxDisplay[i] ) ; frontBoxDisplay[i] = nil
 end
 for i=boxDisplay.numChildren,1,-1 do
     display.remove( boxDisplay[i] ) ; boxDisplay[i] = nil
 end
end

regards,

Guy

Hi ,

I did not resolve this issue yet.

I noticed that the problem occurs more frequently when I update a new version of a game on my phone.

When I clear the phone cache memory I rarely see the problem or not at all.

I need to clean the cache after I install the new game version, clearing the memory after deleting the old game memory and before installing the new version is not giving the same results.

Does it make senses?

Regards,

Guy