I am using LWJGL 2 and 3 to generate 3D scene and I get CPU load and FPS decrease (from 60 to 10-20) spikes after Java garbage collection. Does any one had a similar problem? What can cause it? Here is an image:https://gyazo.com/3747f30bfdc1d9b8546ea06f100578ff
Similar situation with LWJGL 2:https://gyazo.com/84fab09dd4a8914def25add7e10712d0
These images are from Java VisualVM, where I measure performance.EDIT:
I managed to remove spikes by adding these VM paramters, (poor hack
1. I made Heap memory static, so it does not change (first two lines).
2. I made young generation memory only 3m (third line), this forces very frequent, but unnoticable GC.
Ne generation memory is cleared rapidly, however Old generation memory increases very slowly, at some point it should reach limit. This would cause a GC with a lag, however it should happen once in few hours.
Here is an images of Visual GC:https://gyazo.com/056b496b79f7fae98a272396eb2dc7b3
and a CPU and heap usages:https://gyazo.com/4d13263e87ad47c733cdfd243428a641