hotspot JVM garbage collection strategy?

Started by MichaelJPCT, August 14, 2016, 08:47:58 AM

Previous topic - Next topic

MichaelJPCT

in my JPCT app, i use constant framerate(30fps) by adding Thread.sleep at the end of each frame update. as long as the time needed for each frame update doesn't exceed 0.033333 sec, the app runs well.
but if a full gc is performed, a frame will be delayed, and i can't predict when a gc will be performed.
is there any gc mode that does gc "little by little" so every gc doesn't take longer than... say 0.015 sec ?
can gc be performed when my main thread sleeps?

EgonOlsen

You can enable all kinds of GC modes. I don't remember their names, but there are ones that run in parallel to the main thread. Just google it, Oracle has some documentation on it. Apart from that, GC shouldn't be noticable in most cases. Maybe a more precise measuring would help, i.e. calculate a dynamic sleep value.

MichaelJPCT

i do have a dynamic sleep system, i haven't noticed gc slowdown yet - my current average CPU time is at about 30%, but i am afraid when the program gets more complicated and CPU time gets to 70% or more, gc may be noticeable.
and it can cause more trouble if i have multiplayer features - lost of data sync & prediction error. it's a far future for me though.
i have quad-core CPU, i hope the parallel gc is real good.
thanks anyway.

EgonOlsen

I've never experienced GC to be a problem on desktop. On Android it's another story though.