Jump to content

Memory usage (no solution)


Recommended Posts

Hi all!

Does anyone know how to flush the memory used by the process 'on the fly'?

Here is my situation:

- A lot of mods.

- All memory conserving methods I managed to find on forums are used (Active Texture Management, force OpenGL, Half-Res textures setting)

- I have about 2.2 to 2.5 Gb memory used by KSP when the title screen appears after game is loaded (depending on mods used, I am trying to trim my install, but don't want to get rid of all favorite parts)

- Like 2.5 to 2.7 Gb used when I've the savegame loaded

While actually playing KSP with the memory usage as listed above I do not face any crashes and/or severe lags. By playing I mean - piloting my ships/planes/rovers. I happen to travel almost 100km across Mun surface on rover with a couple of quick loadings (due to rover crash), and didn't exceed the available memory. I've also flew an atmospheric plane for more than 1000km (yes, not meters) at the Kerbin to complete the Temperature scan contract and had no issues with memory, I suppose that loading a new terrain while traveling that far is not a big deal for KSP.

But I do have a serious problem at VAB and SPH. While building a new vessel (especially a SpacePlane) I do a lot of tests to ensure that the new toy will fly (or roll, or whatever) as good as I want it to, after each testing launch memory usage is increasing, even if I'm building a rover and the testing area is actually limited to SPH runway. Let's say I enter SPH with 2.7Gb loaded, I'm starting the test run and memory usage comes to 2.8-2.9, then I revert and change a couple of parts, the process memory is still 2.8-2.9, running a next test will consume another 50-150mb, and so on, until I get 3.6-3.7 and a crush after all.

I admit that my real problem is excessive mod usage and my issues can't be addressed to Squad. But maybe someone do know how to deal with the situation above? What actions in game can force the KSP to unload some unused stuff from active memory? Unloading the game back to title screen is not helping (100-200mb unloaded maximum).

Any ideas or suggestions?

UPDATE: Important thing to note that the memory doesn't leak while I do nothing on any screen. So, the problem is not an ordinary memory leak as we all might faced in some other games.

Edited by TC One
additional clarification
Link to comment
Share on other sites

The game in its current versions suffers from memory leaks. AFAIK no one has come up with a solution such as the one you propose.

HOWEVER, in the last Squadcast Maxmaps confirmed that these have been worked on and there are major improvements on that front (memory usage) in the upcoming version.

Here's the Squadcast summary post with the relevant info.

Cheers!

Link to comment
Share on other sites

@Taki117

I've already did that. I suppose my setup wouldn't even load without OpenGL forced ;.;

@eurybaric

Thanks for the link, at least I do know that the leak is not my very own issue.

Edited by TC One
Link to comment
Share on other sites

Meh, opengl and directx really shouldn't make a difference which means you're doing something undocumented (i.e. unstable). Linux or FOSS insanity aside, we're only talking about different flavours of accessing the same hardware. Any "memory savings" is likely to be caused from either texture compression (i.e. non-lossless textures) or not preconverting the textures into usable RAW data (which means you'll only crash later).

Either way, you misunderstand memory usage if you think that it ends with textures. Applying bumpmaps, for instance, is dynamic; procedural generation is also dynamic (hence memory exhaustive). Mods may still be using WWW instead of file accessors, which loads more libraries into memory and has its own buffer (memory waste!). Other mods also follow the "load everything at once" mantra (or worse, have a broken version of parallel processing which COPIES itself for each object rapidly chewing memory).

Add on that KSP cannot effectively garbage collect with very little memory available. (It's a problem with fragments, while you CAN create fragments in memory, it means garbage collection is going to fragment more than it defrags)

Most effective solution would be to go through your mods and start reducing texture sizes down on a per part basis. (Of course, you might have to remap the part :S). If a part is basically like a backpack, it really doesn't need a 1024x1024 texture or larger; 128x128 is perfectly fine until you zoom all the way up. There are tricks you could do if you STREAM texture data, such as reading the pixels as a multiple of X, where X is proportional to the relative size of the object on the screen (Basically, the closer you get the bigger the texture that is loaded; but OTHER textures would decrease which saves memory when dealing with their mappings.); but KSP is unlikely to have that low level of optimizations... so it is a choice between what the provider thinks is "omg awesome looking" or what you think is "I just want this to work"

Link to comment
Share on other sites

Additionally, there is a definite memory leak that occurs when doing the editor-fly-revert cycle. Hopefully that memory leak is also getting attention. I'm not sure yet if going from the editor out to the KSC main complex and back helps clear out the loose memory, but if you get consistent crashes then it might be worth a try.

Cheers,

-Claw

Link to comment
Share on other sites

Fel: that would be true...except the Unity 4.x D3D9 client (KSP's default) has a serious bug where it fails to unload textures from system RAM once they've been uploaded to VRAM. That's why -force-opengl saves RAM, because the OpenGL client doesn't have that bug, so textures are properly unloaded from system RAM once shipped off to the GPU.

Link to comment
Share on other sites

Thanks to all for the answers. I will try to maintain some build/play balance - that minimize my crashes :)

I use Kerbal Construction Time, so like you, I have a lot of launch-revert-launch cycles. And about 2.4GB in use on the menu screen :)

The short version (as others have said) is that the memory leak is inevitable. The memory crash is also a guaranteed event past 3.7GB, and possible above 3.4 if you change scene.

But because of this predictability, you can...

- play in a borderless windowed mode (add -popupwindow to the shortcut) since this will make alt-tabbing instant and easy.

- keep windows task manager open and check KSP.exe's memory usage regularly. Perform a graceful restart before it hits 3.4GB, and you'll never see crashes.

I consider it KSP's way of making sure I go for drinks and snacks regularly. Dehydrated pilots don't fly well :)

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...