Author Topic: Java Game Programming Question  (Read 1695 times)

Offline FireBorn

  • byte
  • *
  • Posts: 4
    • View Profile
Java Game Programming Question
« on: February 20, 2009, 06:47:44 am »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Java Game Programming Question
« Reply #1 on: February 20, 2009, 07:17:34 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?

Offline C3R14L.K1L4

  • int
  • **
  • Posts: 54
    • View Profile
    • CK's place of many works
Re: Java Game Programming Question
« Reply #2 on: February 25, 2009, 04:02:51 pm »
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.