Java Game Programming Question

Started by FireBorn, February 20, 2009, 06:47:44 AM

Previous topic - Next topic

FireBorn

Hi guys,

I know this forum isn't for Java in general, but I thought since so many of you are working on games, I might as well ask here.

Every once in a while, my applet will hang for a couple seconds. Then continue on fine. I can't really figure out the cause of it. I thought it was maybe a synchronization thing so I tried adding synchronized blocks, but they haven't helped.

Could it be the garbage collector? There are a lot of objects that get orphaned during the course of the game, so could this be a possibility?

Thanks,
Ken

EgonOlsen

Quote from: FireBorn on February 20, 2009, 06:47:44 AM
Could it be the garbage collector? There are a lot of objects that get orphaned during the course of the game, so could this be a possibility?
Garbage collection usually isn't noticable and it doesn't take several seconds for sure (unless your applets run on a Pentium 60 or something...). Must be something different IMHO. Do you have an example applet somewhere?

C3R14L.K1L4

Why don't you check in a debugger? For instance, in eclipse (the one I use), start debugging the program, when your program appears to hang, press the pause icon on the debug perspective. Then check the threads and their callstack.