Jump to content

KSP stutters at regular intervals


Recommended Posts

It seems like this happens after I use CTRL+ Z in the VAB or SPH. Once the stutter begins, the vessel I was building will cause it even worse while active, and the stutter never ever ever goes away, it only gets worse the more often I use CTRL + Z. Reloading sometimes solves the problem for a short time, but it returns soon :/. It is far worse with KER, KIS and probably some others.

Does anyone know why this happens and how I can fix it? (I don't want to reinstall my game yet again, because I've finally gotten somewhere and stopped derping around:confused:.)

 

Windows 10 x64
x64 game no mods for this particular complaint
EVGA GTX 980ti:cool:
Core i7-4770k
16gb RAM

 

Tank you!!

Link to comment
Share on other sites

From the info in the OP, I would guess the stutter is caused by garbage collection (GC); however could also come because of a too large footprint in RAM.

Of course more info more probability to diagnose the issue correctly, therefore please try to provide all what is suggested in the guide here.

Do also provide some info about the vessel you are building: if it's large, and KSP has to keep memory of changes you applied (while you use Ctrl-Z), the KSP editor could be running out of RAM therefore inducing frequent GC or RAM swaps.

GC is a mechanism from Unity itself to reclaim unused RAM when the heap is low.

If for any reason the total virtual memory used by all active processes with the OS is larger than the amount of RAM, the OS will have to transfer some memory pages to disk. The more the I/O to disk, and the slower the disk, more time to complete each swap: if KSP is involved with memory swap, it will certainly induce stutters.

If you open the debug window (Mod-F12), in Console/Performance you'll find some Memory data and a graph of the current frame rate. During stutters the frame rate drops; it would be useful to report memory data then (possibly upload and link here a short video with that debug window open).

There are other Windows tools helping to know about memory used by processes (e.g. the Task Manager), if the % of memory used is high and KSP contributes to a large degree stutters are probably due to RAM swap.

About GC, there are a number of add-on tools to help; a good one is MemGraph. It may help solve the issue by itself if really caused by GC, otherwise may provide further info about what's happening.

 

 

Link to comment
Share on other sites

Undo in KSP is VERY wonky due because of the part tree. Things like KER make it worse because they do calcs based on the part tree.

I get something similar at times. I usually just jitter the camera around for a bit, re-root the vessel temporarily, or just place and remove (or vice versa) a random part. Undo was the main culprit in making KSP crash for me when I was designing my space station of around 260 parts. (Memory leaks! Or something akin to it because a couple times it was an Out of Memory crash on a 16GB system.)

Basically I just did an action that would help it refocus onto another activity. On the flip-side, I'm not sure if my case was a graphical or computational issue, so not sure if my experience will actually help you. Generally, the slowdown/stutter I experience in the editor is temporary unless I'm dealing with a lot of parts. (Then some of it is just pure lag from all the crap onscreen.)

Link to comment
Share on other sites

I've watched the Task Manager, there's no noticeable RAM issue there that I can tell, nor can I see anything in MSI Afterburner regarding CPU, GPU or RAM. The issue seems -- to my uneducated eyes -- to be exclusively in-game.

Thanks diomedea, I'll follow your advices and instructions when I get home. I haven't been able to open the debug menu (maybe I disabled it for career mode?) but I'll see what I can do. The last vessel I built with this issue was a shuttle sporting 216 parts at launch, well within the capabilities of my PC. I have video of it, but the save has been deleted (I got mad).

 

Thanks for all your replies!

Edited by Variety_Pack
Link to comment
Share on other sites

10 hours ago, diomedea said:

If for any reason the total virtual memory used by all active processes with the OS is larger than the amount of RAM, the OS will have to transfer some memory pages to disk. The more the I/O to disk, and the slower the disk, more time to complete each swap: if KSP is involved with memory swap, it will certainly induce stutters.

Off topic, I recently found out that Linux has the option to provide swap space via compression of an area of RAM (called "zram"). Compressing and decompressing the data takes extra CPU cycles, of course, but the slowdown is negligible compared to using a disk. One commenter compared it to doubling your available RAM by flicking a switch.

Link to comment
Share on other sites

24 minutes ago, Variety_Pack said:

I haven't been able to open the debug menu (maybe I disabled it for career mode?) but I'll see what I can do.

Didn't ask, but I assumed you be running KSP 1.2.2 (on Windows 10 x64). Debug window opens with Alt-F12 on that.

Should you be using the KSP 1.2.9 pre-release, Debug window could also/or open with Alt Gr - F12 (right side Alt button).

If you are running a third-party software that intercepts the Alt-F12 combo, you may not see that command work on KSP (this is a separate thing, due to other SW installed with the OS: Nvidia Experience is known to use that combo as a default setting for some recording feature, if that's the case you may have to change that setting in the Nvidia Control Panel to have the Debug window work in KSP). Haven't ever heard of a system where KSP Debug window can't be opened if not due to the above.

Link to comment
Share on other sites

On 4/20/2017 at 4:33 PM, diomedea said:

Didn't ask, but I assumed you be running KSP 1.2.2 (on Windows 10 x64). Debug window opens with Alt-F12 on that.

Should you be using the KSP 1.2.9 pre-release, Debug window could also/or open with Alt Gr - F12 (right side Alt button).

If you are running a third-party software that intercepts the Alt-F12 combo, you may not see that command work on KSP (this is a separate thing, due to other SW installed with the OS: Nvidia Experience is known to use that combo as a default setting for some recording feature, if that's the case you may have to change that setting in the Nvidia Control Panel to have the Debug window work in KSP). Haven't ever heard of a system where KSP Debug window can't be opened if not due to the above.

I am running 1.2.1, I forgot to update recently but this bug has happened to me since 1.0, it's not a new thing. Also, none of my saves allow me to use the debug, and I don't have any mods that intercept it. Like I mentioned, Afterburner doesn't register any frame drops, RAM spikes or CPU spikes, nor is the GFX card especially taxed at these hiccups.

I ran the MemGraph. Every red line (trash collection I guess?) accompanied a hiccup. I'll post a video of that here in a few minutes after it's uploaded.

Link to comment
Share on other sites

Here's the video of my stutter. This is after hitting Alt + END one time.

I realize this craft is huge. YES, I know it has too many parts. This isn't my career mode, just a sandbox game for experimenting. I wanted to build and launch a ship like they do on Youtube.

I also know that mods affect the stutter. I don't have very many mods.

Link to comment
Share on other sites

4 hours ago, Variety_Pack said:

I am running 1.2.1, I forgot to update recently but this bug has happened to me since 1.0, it's not a new thing. Also, none of my saves allow me to use the debug, and I don't have any mods that intercept it. Like I mentioned, Afterburner doesn't register any frame drops, RAM spikes or CPU spikes, nor is the GFX card especially taxed at these hiccups.

I ran the MemGraph. Every red line (trash collection I guess?) accompanied a hiccup. I'll post a video of that here in a few minutes after it's uploaded.

Still about the Debug window. Sure you don't have add-ons intercepting Alt-F12: no KSP modder is that dumb to use that key combination, knowing how it is fundamental in KSP (and can't even be changed). I wrote you have another software running in the background that uses that same key combination, and intercepts it while you have KSP active. That other software has nothing to do with KSP. You have a nVidia GPU, so quite probable that background software is nVidia GeForce Experience, it is very well known to use Alt-F12 as default for the FPS overlay enable/disable in Shadowplay.

No surprise MSI afterburner doesn't register drops, nor you see peaks with the GFX.  Same about CPU, no spikes. As written before, your issue is due to GC or RAM swap, you won't see anything relevant with GPU or CPU. From Memgraph, comes very clear the reason is Garbage collection.

3 hours ago, Variety_Pack said:

Here's the video of my stutter. This is after hitting Alt + END one time.

I realize this craft is huge. YES, I know it has too many parts. This isn't my career mode, just a sandbox game for experimenting. I wanted to build and launch a ship like they do on Youtube.

I also know that mods affect the stutter. I don't have very many mods.

Sure the number of parts with a craft can create issues, but what you would most probably see are frame drops due to CPU or GPU solving too many physics. Isn't your case. There is a slight increase of RAM used with a large craft off-rails, as all its parameters are loaded. But unless you keep switching crafts, nothing in RAM would be released and no RAM assigned to new values (not in stock KSP at least). That very intense GC activity shown in the graph means something running within KSP keeps requiring further memory in the heap (probably each single frame) while the heap used is already too high, therefore firing the GC mechanism in Unity.

You don't have many mods. But all seems to point that at least one of those you have is at fault, leaking memory like crazy. 

BTW, having mods makes this thread fit for Technical Support (PC, modded installs) instead of "unmodded installs" where was opened. Moved.

Advice for getting help with modded installs is here. Foremost, provide a list of all the add-ons you have (with version). As you said to be having issues since KSP version 1.0, you probably have one add-on that dates back to that version causing this leak.  A plugin coded for KSP 1.0 most probably is obsolete by now and could present issues anyway. Then, you should test yourself if the GC activity still goes the same running KSP without selected add-ons: when you find which ones are associated with KSP stuttering, report your findings (Note: a memory leak can be caused by a single faulty plugin, but also by unintended interaction of two or more competing ones: in that case you'll see the stuttering only happen when all plugins are active, though each single one by itself won't cause it).

 

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...