Factorio uses too much RAM

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
kilbith
Burner Inserter
Burner Inserter
Posts: 7
Joined: Tue Oct 18, 2016 9:42 am
Contact:

Factorio uses too much RAM

Post by kilbith »

Hello community,

I really love Factorio, however I find it uses RAM in excess for a simple 2D game which don't even use HD textures. To be accurate it uses between 2-3 GB of memory. In comparison, Skyrim uses roughly 700-800 MB with the greatest textures.

I have 4 GB RAM here, if I play Factorio on Linux w/ GNOME, Factorio ends up running in the swap partition (because not enough RAM available) and that makes the game really slow.

Factorio is fairly light in every other aspects except memory consumption. Can the devs consider greatly reducing that ?

Best regards.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Factorio uses too much RAM

Post by Adil »

Do you use any mods? Is your base very big? For me in my longplay maps it's about 1.5 - 2 gb.
And you know, ram usage is not all about textures and graphics at any given time skyrim holds in memory about a hundred maybe a thousand of objects (guards, dragon, sweet rolls), that all have some information about them, factorio needs to remember much more.

Also, default linux swappiness is rather ridiculous, googling up on how to finetune it might be worthwhile.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
kilbith
Burner Inserter
Burner Inserter
Posts: 7
Joined: Tue Oct 18, 2016 9:42 am
Contact:

Re: Factorio uses too much RAM

Post by kilbith »

I don't use any mod, only vanilla Factorio 0.14.x. My base has ~50h of work, I think it's rather big.

I'm aware that memory usage is not all about textures and graphics, but these are the most greedy RAM consumers. Informations or "metadatas" on the map are just strings or tables internally and they're usually much smaller than media files.

What do you mean exactly by "default linux swappiness is ridiculous" ?
User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Factorio uses too much RAM

Post by Deadly-Bagel »

Graphics are handled by the GPU which Skyrim will probably be hammering compared to Factorio (until you get a really dense factory all churning stuff around and you try to zoom out).

However, there is one big difference that is easy to overlook. When you leave a town in Skyrim, the game unloads it. All those people, the houses, the animals, the items, weapons, shops, all disappear. This goes for pretty much any other game, including Minecraft. As you approach an area everything is loaded back into memory while everything behind you is dumped.

Stop and think how the game would play out if Factorio tried to do this ^^
Money might be the root of all evil, but ignorance is the heart.
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Factorio uses too much RAM

Post by daniel34 »

kilbith wrote:What do you mean exactly by "default linux swappiness is ridiculous" ?
https://lokir.wordpress.com/2010/02/23/swapiness/
https://en.wikipedia.org/wiki/Swappiness
quick links: log file | graphical issues | wiki
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Factorio uses too much RAM

Post by Adil »

kilbith wrote:What do you mean exactly by "default linux swappiness is ridiculous" ?
It prefers to swap the needed data on disk instead of dropping cache of dubious usefulness. [1][2]

And do not underestimate the size of 'just strings and tables'.
In a particular set of problems those easily get over Gb size cutoff.
In Dwarf Frotress they've recently moved to 64 bit because they consistently needed more and more memory, without much graphical complexity.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15904
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Factorio uses too much RAM

Post by Rseding91 »

We don't "waste" or "over allocate" RAM anywhere. What it uses is exactly what it needs to run. The base Factorio graphics take up 600 MB of RAM. The base prototypes take up about 200 MB. Anything past that is data required to simulate a given save file.

There's a simple solution: get more RAM. It's cheap and required if you want to play larger saves.
If you want to get ahold of me I'm almost always on Discord.
kilbith
Burner Inserter
Burner Inserter
Posts: 7
Joined: Tue Oct 18, 2016 9:42 am
Contact:

Re: Factorio uses too much RAM

Post by kilbith »

Thanks for the informations, Adil and Rseding91.

RAM is indeed cheap, but think to those who play on laptops... It's not always possible or easy to add more RAM.

Also, the fact that it uses 600 MB for the base graphics is quite concerning for me, Factorio uses simple graphics. This is roughly what Skyrim uses for everything including high quality graphics. That requirement is disproportionately high compared to the rest, that's a pity.
User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Factorio uses too much RAM

Post by Deadly-Bagel »

You guys developed a game that synchronises tens to hundreds of thousands of entities in real time across up to 400 players and you still can't be trusted to handle memory :lol: just can't catch a break can you. Well I believe in you ^^
Money might be the root of all evil, but ignorance is the heart.
bergi9
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Tue Jun 07, 2016 7:54 am
Contact:

Re: Factorio uses too much RAM

Post by bergi9 »

kilbith wrote:Also, the fact that it uses 600 MB for the base graphics is quite concerning for me, Factorio uses simple graphics. This is roughly what Skyrim uses for everything including high quality graphics. That requirement is disproportionately high compared to the rest, that's a pity.
You don't know what you're talking about. Rendering 2D game with Bitmaps (can be compressed) is different than rendering a 3D game with Meshes and Textures. Factorio uses Sprites (multiple images with different positions) to render them, this require more memory than a 3D game which have lower images for texture.
kilbith
Burner Inserter
Burner Inserter
Posts: 7
Joined: Tue Oct 18, 2016 9:42 am
Contact:

Re: Factorio uses too much RAM

Post by kilbith »

bergi9 wrote:You don't know what you're talking about.
Probably, yes. I'm just expressing facts and concerns here, then no need to be offensive or snarky. As a customer I would feel somewhat fscked if Factorio 1.x reached 8 GB or more as RAM requirement.

Also, I do know for sure that Skyrim uses 1024x1024px textures on meshes (Factorio's ones are of much lower resolution). But I agree 2D and 3D engines does not handle texturing the same way, but still...
hoho
Filter Inserter
Filter Inserter
Posts: 684
Joined: Sat Jan 18, 2014 11:23 am
Contact:

Re: Factorio uses too much RAM

Post by hoho »

kilbith wrote:Also, I do know for sure that Skyrim uses 1024x1024px textures on meshes
Only in high-res texture DLC. In vanilla, they used 512x512 textures.

Skyrim also "cheats" by overlaying small detail textures over others for emulating higher detail levels. It's most visible on ground textures IIRC.
kilbith wrote: (Factorio's ones are of much lower resolution).
Accumulators use three textures - one 124x103 pixel icon. 1104x405px charge animation sheet and 1176x384px discharge animation sheet. In total, that's almost as much as a single 1024x1024px texture. Tank uses 14 texture sheets for a total of a little more than 4096x1024 pixels.

2D games require a LOT of memory for textures. In addition, the game map itself has to store a bunch of data, the more you explore the more it takes. In comparison, skyrim uses mostly heightmap with massively lesser amount of data per unit of area and unloads parts that are too far from player while factorio has to keep EVERYTHING in memory at all times.
Post Reply

Return to “Technical Help”