Reputation: 1522
I'm developing a videogame in Android using OpenglES. But I'm having a problem with the main game loop or the renderer, because the game lags every 3 seconds (more or less) and I don't know why. The only thing I know is that it happens all the time, no matter what is going on in the game.
I have a main loop in where I call the gameInput, gameLogic and gameRenderer. When I call the gameRenderer, I wait until it finishes to continue... There are 20 fps every second.
Have this happened to anybody? Or do anybody have a clue about what's going on?
Upvotes: 0
Views: 201
Reputation: 4756
In theory if it's garbage collector you can pass something like this -Xms2G -Xmx2G (heap size) as VM arguments then garbage collector will not run before VM eats all 2G so lag should disappear and you will know that it is garbage collector problem.
Upvotes: 2
Reputation: 709
Do you use java, right? It look like garbage collection. Try to disable parts of code and check if lag disappears. You can localize place where problem occures.
Also if you use Eclipse plug-in has DDMS thing. You can use Allocation Tracker from there to see which objects are created and how many of them.
Upvotes: 1