GC Performance problem in 2D game
Hello!
I'm kinda new to java, but have been working with C++ before. Now, I've decided to try and make a 2D online RPG game as a standalone Java application. All is going fine with it, but I am having some performance problems with (probably) the GC:
Each 4-5 seconds there are a 0.5-1 second freeze! It would be great if there was any way to fix this. I am currently using the following Java command line parameters:
-verbosegc -XX:+UseParallelGC
(The -verbosegc is just temporary so I can see some GC output.)
Other then that (the rest of the time) the game runs more or less smooth. This is the output of the GC when the freeze occurred:
[Full GC 13858K->5787K(18304K), 0.0821987 secs]
(Most other lines does not say Full GC.)
I have worked rather hard the last time to fix all memory leaks and such, and now there are none (or very small) leaks left. I don't think I'm over-utlizing objects or w/e it's called.
Is there btw any way to tell the GC to collect a specifig object?
And, does anyone know how other java games and applications does to get rid of problems with the GC?
I have tried experimenting with some heap size parameters, and it works for short times, while the memory fills up, but then it freezes for much longer periods.
Yours, Jiddo.

