Jump to content

why does KSP needs so much ram?


tonimark

Recommended Posts

Even with my 32 gig RAM KSP gets slow and stuttering at some point (after building/testing many vehicles) , even if the RAM is not halfway full. only a restart cleans this up. Seems KSP has a bad garbage collection in the assigned memory space implemented. 

 

And this is without mods (I don't use any.)

Link to comment
Share on other sites

33 minutes ago, tonimark said:

ram is expensive but ksp struggles to load things causes it takes too much ram and hard drive load due to that , i run less than 90 mods and it is slow the recommended specs are 8 gb of ram (which i have) but it slow as hell...

The recommended specs are for the stock game.  90 mods is a ton.  If you only have 8 GB of RAM, it's time to upgrade if you want a playable experience with that many mods.

Link to comment
Share on other sites

36 minutes ago, tonimark said:

 i run less than 90 mods and it is slow the recommended specs are 8 gb of ram (which i have) but it slow as hell...

First of all, I don't think 90 is  a particularly low number.

Second, it's not the number of mods that matter—it's how much memory they use. If you have mods with many parts and high quality textures it will not take a lot of them to use up significant amounts of memory

Third, the spec recommendation is for stock. Once you start loading up mods (especially 90) you're likely going to need more than just 8 GB.

Edited by Kerbart
Link to comment
Share on other sites

4 hours ago, Meecrob said:

No its not. RAM is cheaper than its ever been. I'm looking at kijiji in my area and name brand 2 x 8GB goes for $40 Canadian.

When I was much younger and working in a warehouse for minimum wage I got an offer for a 16 megabyte ram module for only $200. It meant eating macaroni with ketchup for the next two weeks but the deal was simply too good to pass on.

Yes memory is cheap these days. Even relatively speaking; maxing out the memory of your average desktop or laptop is much cheaper now than it was in the past.

Link to comment
Share on other sites

35 minutes ago, Kerbart said:

When I was much younger and working in a warehouse for minimum wage I got an offer for a 16 megabyte ram module for only $200. It meant eating macaroni with ketchup for the next two weeks but the deal was simply too good to pass on.

I spent exactly that on 4 1MB chips in about 1995. They maxxed out my aging 486-DX and allowed me to put off buying a new computer for a fairly critical year where I was very broke. As it was, $200 was way more than I could really afford but I did it anyway because some game needed it :D

Link to comment
Share on other sites

On 1/2/2021 at 5:44 AM, Superfluous J said:

I spent exactly that on 4 1MB chips in about 1995. They maxxed out my aging 486-DX and allowed me to put off buying a new computer for a fairly critical year where I was very broke. As it was, $200 was way more than I could really afford but I did it anyway because some game needed it :D

Ah, this reminds me of a painful RAM-related story from many years ago. Must have been the late 90s, and I was pretty cross to learn that a colleague had managed to convince a department manager to spend £10k on a 128 MB memory upgrade, to double the RAM in his favourite IBM RS/6000 workstation. It was annoying for a few reasons, but mainly because I had just spent the previous few months successfully demonstrating that Linux-based PC workstations ran all of our codes faster than the workstation in question, and the total cost of the PCs I was using at the time was around £5k with 512 MB installed. Facepalm time.

Meanwhile, my PC now has 16 GB of RAM, and even though it has some left over when KSP hits 8 GB or so, I still need to restart the game at or before that point cos it just crawls (not thrashing, just damn slow). I only have KAC installed, along with BG and MH, so I guess this is just how it is.

Link to comment
Share on other sites

45 minutes ago, Neilski said:

Meanwhile, my PC now has 16 GB of RAM, and even though it has some left over when KSP hits 8 GB or so, I still need to restart the game at or before that point cos it just crawls (not thrashing, just damn slow). I only have KAC installed, along with BG and MH, so I guess this is just how it is.

I know this behavior. I play vanilla Ksp on a 32 gig machine with a 9700K. At some point i have to close the game and restart, as the game gets reaaaaaaal sloooooooooow and stuttering. And at this Point ksp doesn't even use 8 Gig RAM. Somehow it seems to clutter  up its allocated memory and does neither allocate more nor cleans up old garbage. It's not a fault of my machine, as it happens only in Ksp and not in other RAM-hungry applications.

Edited by Rakete
Link to comment
Share on other sites

Mods aside, mathematical equations chew up RAM.  And KSP is running a bunch of equations all the time, calculating distance and dV and TWR and such.  RAM is cheap, so stuff your machine with as much as you can.

And now the next question:  why are you running 90 mods?  I'm running KIS, KAS, and MechJeb...and that's about all I need.

Edited by Popestar
Link to comment
Share on other sites

43 minutes ago, Popestar said:

Mods aside, mathematical equations chew up RAM.  And KSP is running a bunch of equations all the time, calculating distance and dV and TWR and such.  RAM is cheap, so stuff your machine with as much as you can.

And now the next question:  why are you running 90 mods?  I'm running KIS, KAS, and MechJeb...and that's about all I need.

Thank you!

Not many realize this, though it can be reduced by different implementations of the same function. But generally those calculations have to keep each previous one held in memory, until the final answer is desired. Then they can be smashed together and the memory released back to the OS. Even one poorly written math function can  consume well over 4GB of RAM, and even optimization can only do so much (And in some cases might INCREASE RAM usage) by trading memory for speed.

And that's just one function, KSP has numerous ones that all have to trigger in fairly rapid succession. It's actually pretty awesome they managed to make it work for 8GB all things considered.

Link to comment
Share on other sites

1 hour ago, Popestar said:

Mods aside, mathematical equations chew up RAM.  And KSP is running a bunch of equations all the time, calculating distance and dV and TWR and such.  RAM is cheap, so stuff your machine with as much as you can.

And now the next question:  why are you running 90 mods?  I'm running KIS, KAS, and MechJeb...and that's about all I need.

Umm... hardly. What primarily chews up memory is that the way KSP was written, ALL assets are loaded at the start and held in memory at all times. That's sounds, textures, models, etc etc. Most other games load levels or assets "on demand" which does slow them down a bit at times, but reduces their memory footprint significantly.

Code itself is generally small. Maths functions in particular don't allocate memory so they barely impact RAM.  There are lots of management and informational functions which DO use up lots of RAM though because they are constantly allocating memory. Poorly written (primarily mod) code can easily consume loads of memory especially if it runs several times each frame.  It takes some care to write decent mod functionality.

But maths? Not so much, that's one thing which computers are actually very very good at.

Link to comment
Share on other sites

I've just retired my old computer (that I built in 2008) -- yes, it was 12 years old.  The motherboard was limited to 8 GB of DDR3 RAM.

New computer has 64 GB of DDR4 RAM.  Now I can run KSP all day *and* run a browser at the same time.  Yay.

Bottom line: KSP leaks memory.  Scene changes  (going in and out of Flight View) seem to be the main offender.  I used to have to have a System Monitor running and keep an eye on memory usage and schedule a precautionary KSP reboot after the machine went into swap territory.  I'm on 1.7.3 and have reason to believe memory behavior might be somewhat different since about 1.8 (??) when some attention got put on memory management...

Edited by Hotel26
Link to comment
Share on other sites

2 hours ago, Hotel26 said:

I'm on 1.7.3 and have reason to believe memory behavior might be somewhat different since about 1.8 (??) when some attention got put on memory management...

1.8 moved to a new version of Unity (2019.2.2.f1) and thus DotNet (4.x up from 3.5) which may have helped. 

Link to comment
Share on other sites

9 hours ago, Hotel26 said:

I've just retired my old computer (that I built in 2008) -- yes, it was 12 years old.  The motherboard was limited to 8 GB of DDR3 RAM.

New computer has 64 GB of DDR4 RAM.  Now I can run KSP all day *and* run a browser at the same time.  Yay.

Bottom line: KSP leaks memory.  Scene changes  (going in and out of Flight View) seem to be the main offender.  I used to have to have a System Monitor running and keep an eye on memory usage and schedule a precautionary KSP reboot after the machine went into swap territory.  I'm on 1.7.3 and have reason to believe memory behavior might be somewhat different since about 1.8 (??) when some attention got put on memory management...

I've got 16 GB on my laptop, and today was the first time I noticed any lag.  53 parts, 2 Kerbals...and it went fine after the first stage.

Link to comment
Share on other sites

10 hours ago, Hotel26 said:

Bottom line: KSP leaks memory.

Indeed. I've seen long-running KSP instances at ~28GB just before the OOM killer nukes them.
IME it also starts to get flaky and slow down noticeably at around the 10-12GB mark regardless of whether the system has free memory or not.  I suspect Unity / mono wasn't really designed with such memory usage in mind.

Link to comment
Share on other sites

On 1/4/2021 at 6:39 PM, Hotel26 said:

line: KSP leaks memory.  Scene changes  (going in and out of Flight View) seem to be the main offender.  

Exactly my observation.

 

18 hours ago, steve_v said:

IME it also starts to get flaky and slow down noticeably at around the 10-12GB mark regardless of whether the system has free memory or not.  I suspect Unity / mono wasn't really designed with such memory usage in mind.

Yeah, it's sad, that the engine does not draw profit of huge RAMs like my 32GB. At some point it gets stuttering and needs a restart.

Link to comment
Share on other sites

Not just memory leak but memory waste.  KSP was not designed to be as large as it's become.  The old "load everything on start" model worked great when there was 5 parts and a barely-textured planet.  It's not so great now.

Edited by Corona688
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...