When making my simple app for revisions to update the latest changes, I test it first between the device (Google Nexus 7) and desktop using Eclipse IDE. I made eleven screens for the game in terms of the following for testing:
- Splash screen (usually the company's logo)
- Game content (Usually announced if it's rated E or M, for example)
- Loading Screen
- Title screen
- Main Menu screen
- Player 1's registration screen
- Player 2's registration screen
- Player list screen
- Game screen
I tried testing switching screen by running onto the desktop and it works without limits. However, on running device, every time I switched or went to the next screen the eighth time, The app suddenly returned back to the Android desktop menu as if the app closes without notifying an error message meaning that this app worked normally.
Was it has a gimmick or something that there is a memory leaking issues due to switching screens? The images went okay with 100% bad memory leaks issue free but switching screen is going limited now instead, compared to the desktop test. What can I do or suggest something?
Here's the first part why does the app suddenly shuts down without error notification. Take a look at this Logcat:
01-29 10:48:27.846: E/AndroidRuntime(11707): at com.Bodapps.KinkyTime.Models.Images.Dispose_Images(Images.java:329)
01-29 11:02:27.636: I/dalvikvm-heap(12963): Grow heap (frag case) to 8.416MB for 790411-byte allocation
01-29 11:02:27.646: D/dalvikvm(12963): GC_CONCURRENT freed 0K, 12% free 8472K/9520K, paused 3ms+2ms, total 16ms
01-29 11:02:27.646: D/dalvikvm(12963): WAIT_FOR_CONCURRENT_GC blocked 13ms
01-29 11:02:27.646: D/dalvikvm(12963): WAIT_FOR_CONCURRENT_GC blocked 13ms
01-29 11:02:27.836: D/dalvikvm(12963): GC_CONCURRENT freed 1125K, 18% free 7819K/9520K, paused 2ms+1ms, total 17ms
01-29 11:02:27.916: D/dalvikvm(12963): GC_CONCURRENT freed 371K, 18% free 7865K/9520K, paused 2ms+2ms, total 17ms
01-29 11:02:27.976: D/dalvikvm(12963): GC_CONCURRENT freed 544K, 19% free 7768K/9520K, paused 1ms+1ms, total 16ms
01-29 11:02:27.976: D/dalvikvm(12963): WAIT_FOR_CONCURRENT_GC blocked 11ms
01-29 11:02:28.036: D/dalvikvm(12963): GC_CONCURRENT freed 384K, 18% free 7867K/9520K, paused 2ms+2ms, total 17ms
After I switched the screen the 6th or 7th time, the app closes due to memory leaks in LibGDX and here's the result:
01-29 11:10:58.546: I/dalvikvm-heap(13772): Grow heap (frag case) to 8.662MB for 790411-byte allocation
01-29 11:10:58.556: D/dalvikvm(13772): GC_CONCURRENT freed 0K, 20% free 8723K/10808K, paused 2ms+2ms, total 17ms
01-29 11:10:58.556: D/dalvikvm(13772): WAIT_FOR_CONCURRENT_GC blocked 15ms
01-29 11:10:58.556: D/dalvikvm(13772): WAIT_FOR_CONCURRENT_GC blocked 14ms
01-29 11:10:58.816: D/dalvikvm(13772): GC_CONCURRENT freed 1122K, 26% free 8066K/10808K, paused 1ms+2ms, total 34ms
01-29 11:10:58.886: D/dalvikvm(13772): GC_CONCURRENT freed 371K, 25% free 8111K/10808K, paused 2ms+3ms, total 21ms
Now, not all time that putting all the materials should be put at dispose() method and will work. I decided to put the disposals under in the IF-ELSE statement code for touch button functionality. It seems more promising to free more memory than relying on the dispose() method but the result ends like this:
01-29 11:05:22.076: A/libc(12963): Fatal signal 11 (SIGSEGV) at 0x653815c0 (code=1), thread 12985 (Thread-6635)
Is there any good way to free up memory so that switching from menu to menu will not be bothered?