How much ram does X4 actually need?

This forum is the ideal place for all discussion relating to X4. You will also find additional information from developers here.

Moderator: Moderators for English X Forum

user1679
Posts: 1088
Joined: Fri, 20. Jul 18, 23:20

How much ram does X4 actually need?

Post by user1679 »

I'm running a modded game so I'm not reporting this as a bug, but lately I've been experiencing a "panic" crash where the game fails to allocate enough memory. I have 26 GB of RAM (and 12 GB VRAM) and my save is about 7 hours old. I'm inclined to think in my case this is probably a mod with a memory leak, but I did google the issue and found comments from older versions of players with unmodded games also having this problem.

But, I am curious how much RAM this game is actually going to use as you explore more and more sectors and factions build more and more stations. I had MSI Afterburner running after I loaded my save and it was at 14 GB actual with 19 GB commit.
Falcrack
Posts: 5732
Joined: Wed, 29. Jul 09, 00:46
x4

Re: How much ram does X4 actually need?

Post by Falcrack »

Minimum is 8 GB, recommended is 16 GB, but you might benefit from more. Any more than 32 GB is overkill and likely won't be of any further benefit.
User avatar
Baconnaise
Posts: 766
Joined: Sat, 23. Nov 13, 15:50
x4

Re: How much ram does X4 actually need?

Post by Baconnaise »

X4 and its forebear Rebirth typically use around 8-10GB if you have 16GB. If you have 32GB or more it generally gobbles up 10-16GB. I don't think I've ever witnessed it trying to take more than 16GB. I imagine it could or can if you use heavier textures etc. The biggest limiting factor with either game has been CPU not ram or GPU. Sure GPU helps but your biggest bottleneck is CPU. X3D cpus are your best option for best performance. I upgraded to a used 5800x3d changing out my 3600 non-X and it more than doubled my FPS using an RTX 2060 at 4K/1440 and tripled it when set to 1080.

EDIT: I would also bear in mind that either game 90% of my time in either was spent with several mods upwards of one hundred at any given time.
LameFox
Posts: 3644
Joined: Tue, 22. Oct 13, 15:26
x4

Re: How much ram does X4 actually need?

Post by LameFox »

Back when someone posted about a memory leak in their 6.0 game I managed to get it up to 20GB RAM use while leaving it running overnight. This seemed to be reliant on remaining in the same sector and would go down if I moved around. I actually haven't check that in a long time, not sure if it was fixed since then.
***modified***
User avatar
Baconnaise
Posts: 766
Joined: Sat, 23. Nov 13, 15:50
x4

Re: How much ram does X4 actually need?

Post by Baconnaise »

LameFox wrote: Wed, 11. Dec 24, 05:23 Back when someone posted about a memory leak in their 6.0 game I managed to get it up to 20GB RAM use while leaving it running overnight. This seemed to be reliant on remaining in the same sector and would go down if I moved around. I actually haven't check that in a long time, not sure if it was fixed since then.
I don't doubt the issue existed at some point. Rebirth had a mem leak and broke saves for several patch cycles. I'm also fairly certain I had a masochist phase because I kept playing that game lmao despite everything from launch.
User avatar
EGO_Aut
Posts: 2410
Joined: Mon, 2. Dec 19, 19:40
x4

Re: How much ram does X4 actually need?

Post by EGO_Aut »

Min. 12 GB (observed over Task Manager)

I had 8 GB, but <1 year ago it was not playable under windows-a lot of lags and low fps combined with very long load times (in game).
After upgrading my RAM to 16 GB everything was fine.
user1679
Posts: 1088
Joined: Fri, 20. Jul 18, 23:20

Re: How much ram does X4 actually need?

Post by user1679 »

LameFox wrote: Wed, 11. Dec 24, 05:23 Back when someone posted about a memory leak in their 6.0 game I managed to get it up to 20GB RAM use while leaving it running overnight. This seemed to be reliant on remaining in the same sector and would go down if I moved around. I actually haven't check that in a long time, not sure if it was fixed since then.
Interesting, the most recent time this happened to me I was hanging out in Second Contact - Flashpoint, watching a battle between ARG and HOP and managing my other ships around the map. I think I was there for at least an hour (and alt-tabbing) when suddenly the "panic" error happened.

When the error popped up, my FPS dropped to 7 and I couldn't even bring up task manager to see how much RAM was being used and by what. I had Firefox open at the time and I know it can sometimes leak memory where a tab will consume 5 GB of ram.
Dominus
Posts: 496
Joined: Fri, 26. May 06, 13:06
x4

Re: How much ram does X4 actually need?

Post by Dominus »

In linux unmodded at 2k+ ships and 20k+ station modules 16GB is not enough after 4 hours. It starts to get slower and at some point opening the map eat the remaining RAM and hangs the game.
Denantes mortos que escravos.
Sorry for Bad english. :)
CBJ
EGOSOFT
EGOSOFT
Posts: 54290
Joined: Tue, 29. Apr 03, 00:56
x4

Re: How much ram does X4 actually need?

Post by CBJ »

That's not normal. Please make a Tech Support report with as much information as possible, including your system info, driver information and savegame.
user1679
Posts: 1088
Joined: Fri, 20. Jul 18, 23:20

Re: How much ram does X4 actually need?

Post by user1679 »

Dominus wrote: Fri, 13. Dec 24, 13:01 In linux unmodded at 2k+ ships and 20k+ station modules 16GB is not enough after 4 hours. It starts to get slower and at some point opening the map eat the remaining RAM and hangs the game.
Are those your ships/stations? That sounds crazy. I haven't even built a single station and only have 3 M traders, a couple S interceptors and a L cruiser that I found. I think I spend too much time watching the asteroids spin and listening to the background music. Not to get off-topic but some of the music reminds me of the Battlestar Galactica reboot from 2003.
Imperial Good
Moderator (English)
Moderator (English)
Posts: 4933
Joined: Fri, 21. Dec 18, 18:23
x4

Re: How much ram does X4 actually need?

Post by Imperial Good »

I think X4 has a dynamic RAM limit. It tries to use as much RAM as it can up to some amount relative to the installed memory. As such X4 can end up using more memory on a system with 32 GB of RAM installed than on one with only 16 GB.

This RAM, and even VRAM, is used to cache assets. Most modern games do this to some extent.
user1679
Posts: 1088
Joined: Fri, 20. Jul 18, 23:20

Re: How much ram does X4 actually need?

Post by user1679 »

Imperial Good wrote: Sat, 14. Dec 24, 17:42 I think X4 has a dynamic RAM limit. It tries to use as much RAM as it can up to some amount relative to the installed memory. As such X4 can end up using more memory on a system with 32 GB of RAM installed than on one with only 16 GB.

This RAM, and even VRAM, is used to cache assets. Most modern games do this to some extent.
That's what I assumed, which is why I was surprised when it tried to allocate *more* when it already had 14 GB, and failed. Usually games will free cached assets if they need RAM that isn't available. But I rarely see X4 give ram back when watching it in Afterburner. Usually a few hundred MB will drop now and then but it quickly reallocates it.
Imperial Good
Moderator (English)
Moderator (English)
Posts: 4933
Joined: Fri, 21. Dec 18, 18:23
x4

Re: How much ram does X4 actually need?

Post by Imperial Good »

user1679 wrote: Sun, 15. Dec 24, 02:59 Usually games will free cached assets if they need RAM that isn't available.
As far as I am aware, applications like games have no sensible way to tell when RAM is not available. Games like Diablo IV try to allocate up to 75% of installed memory, even if under 75% is available due to background applications and OS using more than 25%.

In my opinion a well written game would give users access to configure the approximate cache sizes so that they could customise the game memory usage to their potential needs.
user1679
Posts: 1088
Joined: Fri, 20. Jul 18, 23:20

Re: How much ram does X4 actually need?

Post by user1679 »

Imperial Good wrote: Sun, 15. Dec 24, 13:22
user1679 wrote: Sun, 15. Dec 24, 02:59 Usually games will free cached assets if they need RAM that isn't available.
As far as I am aware, applications like games have no sensible way to tell when RAM is not available. Games like Diablo IV try to allocate up to 75% of installed memory, even if under 75% is available due to background applications and OS using more than 25%.

In my opinion a well written game would give users access to configure the approximate cache sizes so that they could customise the game memory usage to their potential needs.
When I used to write programs using C++ the system functions to allocate memory will fail if there wasn't enough, giving me the opportunity to say "well, I don't need this anymore" and free the pointer to the allocated memory and reallocate it, or just reuse the pointer. Obviously reusing pointers can be bad, especially if you're passing them around various classes and objects. To avoid crashing it's easier to free/allocate.

So in theory, X4 could say "well I don't need these 20 planets cached anymore" if the player isn't near those sectors. But that's assuming it would free enough RAM to actually make a difference.
Imperial Good
Moderator (English)
Moderator (English)
Posts: 4933
Joined: Fri, 21. Dec 18, 18:23
x4

Re: How much ram does X4 actually need?

Post by Imperial Good »

user1679 wrote: Mon, 16. Dec 24, 05:14 the system functions to allocate memory will fail if there wasn't enough
They only fail if the system runs into the commit limit. This can happen either after all installed memory is in use due to the page file, or before all installed memory is used due to 0ed pages occupying commit limit but not physical memory. The issue is avoiding using the page file as that tanks performance.

There might be specific OS kernel calls that let you try to allocate memory in a way that fails if it cannot reside in physical memory, but this would cause another problem...
user1679 wrote: Mon, 16. Dec 24, 05:14 giving me the opportunity to say "well, I don't need this anymore" and free the pointer to the allocated memory and reallocate it
If multiple applications did this it would end up with the same problem as internet based flow control which also increases window size until transmission failures occur. Applications might be stuck unable to allocate memory because other applications grab it first, or applications that do have memory might have their allocation swing wildly over time due to fighting with another application. This is likely why this is not common practice, as far as I am aware there are no APIs that allow applications to coordinate memory usage with each other, and if there were most applications will likely not be using them.
jlehtone
Posts: 22563
Joined: Sat, 23. Apr 05, 21:42
x4

Re: How much ram does X4 actually need?

Post by jlehtone »

Ideally, all memory is always in use. If nothing else, for cache/buffers by OS. They can yield though.

You can probably query OS for installed memory, "free" memory, cache/buffer usage, swap, etc.
Problem is that most of those values can be dynamic. You either go with what you see at start,
continuously recheck what is available, or simply try to allocate and handle failure somehow.
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.
user1679
Posts: 1088
Joined: Fri, 20. Jul 18, 23:20

Re: How much ram does X4 actually need?

Post by user1679 »

Yes, it certainly depends on the application and what it needs the memory for. Obviously we don't know what the memory manager looks like for X4 but in similar programs, if a call to malloc fails with ENOMEM, it might be possible to free / reuse some RAM you already allocated (eg: Player is in Argon Prime, you might not need all the asteroids / stations / planets you allocated for in Bright Promise). But often it's easier to simply "crash" so you don't continue in some unknown state.

Personally I'd rather lose a few minutes of playtime via a crash than risk a corrupt save game.

Also, in my case I just realized I didn't increase my pagefile when I increased my RAM. And while a pagefile isn't ideal vs RAM, having one that's less then 1/2 the installed RAM can lead to problems in memory hungry applications.

Return to “X4: Foundations”