I am working on a critical time time with a time limit of 40 ms per iteration. If the time limit is exceeded only once, the application is terminated and the game ends. The application itself does not have problems staying under 40 ms, it is a garbage collector that sometimes exceeds the limit.
Using the object pool in combination with the factory pattern, I basically managed to eliminate the need for garbage collection, and the application achieved a stable iteration time of 17 ms, including small GC runs, except that from 10 to 20 iterations after the application was launched, there was only one complete GC that exceeds 40ms and kills my application.
My question is, how can I analyze what exactly causes this full GC? I used jvisualvm extensively to describe the runtime and amount of memory, and this helped identify the objects that I need to cache. But in this particular case, I canβt use it, because the full GC happens long before I can press the right buttons in jvisualvm. Is there a way to generate a bunch of heaps programmatically?
source share