shadowmage45 / KSPWheel

Replacement for U4 wheel collider, geared for use in KSP.
GNU General Public License v3.0
41 stars 19 forks source link

Excessive Mono Heap Allocation #64

Open friznit opened 5 years ago

friznit commented 5 years ago

Running mem graph shows the mono heap allocation spiking when parts from these mod load into the world and the garbage collection subsequently runs every 10 seconds or so, causing a periodic "stutter" (it's unity doing its thing). I can't see anything related in the logs, though I'm not an expert - log attached for reference. It doesn't really manifest when running the mods alone, presumably as there's sufficient overhead to cover it, but when you add in a couple of parts/graphics/life support things tank rapidly. KSP.log

shadowmage45 commented 5 years ago

Have reviewed the simulation code and there doesn't appear to be any needless garbage generation there. All loops are done with numeric iterator constraints, no new objects are allocated on the heap, all references are cached were possible.

Quite possible that the issue is with the dust and sound code (more likely the dust part...). Doesn't look like I'll be able to get it cleaned up for the next release, but I will spend some time investigating the source of this issue in the near future.

One thing that might help -- you might try disabling dust-effects in the in-game KSPWheel settings; might mitigate the problem, or at least give some confirmation as to its location.

HorusAK commented 5 years ago

Turning off dust effect didn't help much.

shadowmage45 commented 5 years ago

Thanks for the info. Will put that to use during my investigations (which will hopefully be sooner rather than later...).