Hi,
First of all, I just want to make sure that my problem is about memory leak. The game crashes at some point without giving any errors in neither logcat nor the Android device.
Let me describe the problem first: ( this is the small part of a game )
1- I start the game app. (~920kb memory)
2- I navigate through the menu, click on How to play menu and then Credits and so on. The memory usage increases at first, but goes back to 920 kb memory when I’m back at the main menu as expected.
3- After that, I want to play the game and press the play button.
4- I watch my first story scene (storyScene1.lua). (When I go back to mainMenu from this scene, the game can free the memory it allocated before. The memory usage in the main Menu is still ~920kb.)
5-When it ends, I changeScene to my second story scene (act1Intro.lua). When the transition is done, my minimum memory usage is increased to ~940 and even if I go back to main menu from that point, I can’t free that allocated memory and see 920 kb ever again in the main menu. 20 kbs of memory is allocated and I can’t free it in anyway.
6- The thing I want to achieve is to start the game after these story scenes(first load, then start playing) but when I do it, I see that my minimum Lua memory usage is increased to ~1080 kb when I return to main menu.
******** The part that got my attention was that, the minimum allocated memory amount does not increase when I reproduce these steps. When I progress throughout the levels, it keeps increasing like this but when I go back to main menu and restart the game from the 1st level and play all the levels until the one where I left off, the allocated memory amount does not change. It is the latest amount where I returned to main menu. It stays the same as if all these scenes are alive all the time and are not deleted from the memory at all.
I’d be very thankful for any good advice on that matter.
Thank you
(I’m using Director 1.4 by the way.
Corona SDK version 2013.1202.)
Here’s the sample project:
