Game keeps crashing at a certain point without explanation

First off, I'm sorry if this question is too general but I really need a hand. I made a Galaxian clone for android to experiment with the libGdx library. It runs just fine both on PC and Android. I then ported it to OUYA and it seemed to run fine, up until the point where all of the enemy ships have lined up and they start dropping, when it crashes and get me back to the games menu.

I tried pretty much all I could think of to fix it but to no avail. I was hoping someone could look into it and maybe tell me what's wrong with my code and/or setup.


I'd be grateful if you could help me out. Thanks!

Comments

  • ShushShush Posts: 178Member
    I tried your apk a few times and noticed how unhelpful logcat was even when picking through it with a fine tooth comb. A lot of stuff seems to go belly up:

    I/ActivityManager(  304): Process tv.ouya.console (pid 2857) has died.
    W/ActivityManager(  304): Scheduling restart of crashed service tv.ouya.console/.launcher.store.CacheTicklerService in 5000ms
    I/ActivityManager(  304): Process android.process.media (pid 2870) has died.
    I/ActivityManager(  304): Process tv.ouya (pid 2845) has died.
    W/ActivityManager(  304): Scheduling restart of crashed service tv.ouya/.provider.app.download.AppDownloadService in 12723ms
    I/ActivityManager(  304): Process tv.ouya.console.ime.keyboard (pid 2979) has died.
    W/ActivityManager(  304): Scheduling restart of crashed service tv.ouya.console.ime.keyboard/.OUYAKeyboard in 21959ms

    I/ActivityManager(  304): Process com.melloland.galaxian (pid 2961) has died.
    I/WindowState(  304): WIN DEATH: Window{4274ed78 SurfaceView paused=false}
    W/InputDispatcher(  304): channel '427210d8 com.melloland.galaxian/com.melloland.galaxian.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
    E/InputDispatcher(  304): channel '427210d8 com.melloland.galaxian/com.melloland.galaxian.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
    W/InputDispatcher(  304): Attempted to unregister already unregistered input channel '427210d8 com.melloland.galaxian/com.melloland.galaxian.MainActivity (server)'
    W/ActivityManager(  304): Force removing ActivityRecord{42576ea8 com.melloland.galaxian/.MainActivity}: app died, no saved state
    I/WindowState(  304): WIN DEATH: Window{427210d8 com.melloland.galaxian/com.melloland.galaxian.MainActivity paused=false}
    I/WindowManager(  304): WINDOW DIED Window{427210d8 com.melloland.galaxian/com.melloland.galaxian.MainActivity paused=false}
    I/ActivityManager(  304): Start proc tv.ouya.console for activity tv.ouya.console/.launcher.PlayActivity: pid=3245 uid=10016 gids={3002, 3001, 3003, 1015, 1023, 2001, 1028}

    And yes it reliably crashes at the same point each time, what sound effect/graphic/resource are you trying to load/play at that point?
  • DeejayDeejay Posts: 5Member
    When exactly did you get all of these messages? And I thought it was a resource that caused the crash too, but the only thing it does at that point is play a sound effect when the ships drop and even when I commented it out, it was still crashing.
  • ShushShush Posts: 178Member
    That spam I posted is only a partial dump, the rest of it didn't seem crucial, GC/AwesomePlayer/MPEG/etc.

    If you do an "adb logcat >logcat.txt" you can see what I see too, the spam starts as soon as the game crashes when the first ship tries to drop, I can't find any of your source in the .rar, so I am assuming when it tries to load/play sndDrop.wav is when it flies off into lala land.
  • DeejayDeejay Posts: 5Member
    All the actual source of the game is in the folder galaxian\src. The rest is built by libgdx to port the game to multiple systems.

    But yeah, even if it doesn't play anything, it crashes at the same place, so I doubt it's a problem with the sound player. I'm sure I checked everything, but still...
  • ShushShush Posts: 178Member
    /facepalm ok I found your source.

    Are you able to set a breakpoint around chasePlayer()? I followed the code and I don't see anything obviously wrong with chasePlayer() and the Enemy::update::STATE_CHASE case in your enemy update state machine.
  • DeejayDeejay Posts: 5Member
    I can't exactly debug the console because of the distance between it and my computer. Anyway, after a few code commenting and apk exporting, it looks like the problem is most likely in the Game.run() function. If you didn't notice (and I just did myself) it crashes even if you don't press anything. After some time has gone, it crashes, just like that. After commenting the Game.run() statement and putting a chronometer instead, it stopped crashing, so that's why I think the problem's there. Where exactly, I still have to find out.
  • DeejayDeejay Posts: 5Member
    Well shit, I found the problem... looks like I just forgot to dispose() the texture and pixmap I use to draw solid color rectangles. So the buffer builds up and eventually grows big enough to make the game crash.

    I kinda feel stupid for not having discovered this sooner. Sorry guys.

    Well, thanks for pointing me in the right direction, anyway! I'll make sure to manage my garbage collection better in the future D=
  • ShushShush Posts: 178Member
    Good job, it kind of makes sense now in hindsight with how seriously the OS was bombing in logcat.
Sign In or Register to comment.