mitch3a / SuperMarioWar

Hoping to rewrite existing SMW code in java with the hopes to fix crashes + expand play
7 stars 2 forks source link

Gameplay Slows Down #1

Closed mitch3a closed 10 years ago

mitch3a commented 10 years ago

After running for a couple minutes, the game drastically slows down.

grawin commented 10 years ago

Could be a memory leak somewhere, this tool might help (I tried using it while changing main loop / gfx stuff) http://visualvm.java.net/

mitch3a commented 10 years ago

It looks like the heap size keeps getting bigger and until the GC needs to do a ton of work then BWAMPPPP... so reducing the heap size actually makes this better to cause little GCs that aren't as performance destructive. Also, might want to make sure we aren't allocating memory unnecessarily. This article is pretty good: https://code.google.com/p/libgdx-users/wiki/ForceGarbageCollection . Installing the IBM Monitoring and Diagnostic Tools for Java.

mitch3a commented 10 years ago

We need to be as good as we can about allocating things on the fly (lookout for strings!) but the biggest help is adding -Xms150m -Xmx150m to your VM arguments for your debug configuration. Couldn't figure out how to put this in source control so i'll leave this task open for now.

mitch3a commented 10 years ago

Found how to put the heap settings in a "common" run/debug config. Will do this tonight (hopefully). Instructions are here http://stackoverflow.com/questions/8625060/store-run-configuration-with-project-in-eclipse

mitch3a commented 10 years ago

Added a default launch. Can be found at top level. Just right click and debug/run as and it will add it to your run/debug configurations list..