3.19 Memory Leaks

Tambien

Theseus, Duke of Athens
Joined
Mar 21, 2011
Messages
4,118
Location
The Best Place on Earth, Virginia
This is just a general question.

I have heard thata CIV has a memory leak problem. I went on google and it looks like memory leaks involve a program eating memory but not choking it back up. This is scary to me. Now, I have a few questions.

1) Does it take the memory permanently, or just until the system is shut down?

2) Can it affect the runability of mods if you have tiny RAM? (IE-2 GB)
 
Short version:
1) Only lasts until the program ends.
2) Yes it could, although 2GB is usually enough. There are also other factors.

Long version:

It only lasts as long as the program is running. The instant the program ends all of the memory goes back to the operating system for use by other things. The memory isn't gone or damaged, it is just that as far as the operating system knows it is already in use but the program that it was assigned to has lost track of it and therefore can't use it either, and a program that has this flaw tends to just keep getting assigned more memory and forgetting it has it until there is no more that it can have - then the program falls over dead (and all the memory it was assigned becomes available again).

There can be exceptions to this in some cases, but Civ is not one of them. Device drivers, the operating system itself, and things of that nature can cause memory to be lost in such a way that it requires a reboot to get it back. Ordinary programs can trigger the problem in, for example, the driver for your graphics card if it has such a problem but will not normally be able to do it themselves.

Large mods have a tendency to have what is know as a "MAF" type crash. MAF = Memory Access Failure, which happens when it tries to allocate memory to do something, like when a unit is built it needs some more memory to hold the data for it, but can't get the additional memory. If it can't get any more memory, because it is already using as much as it can, the Civ program crashes. The memory leak causes the program to use more and more memory as you play, so it tends to run out eventually. This can happen even without a mod, but it is not likely since the amount of memory the unmodded game uses is designed to be small enough that there is generally enough room to play until the end of the game all in one sitting without it happening. The larger the mod the more likely it is to happen, and the quicker it will do so. The really big mods can have it happen pretty quick.

Not that it will help you much, but technically it isn't physical memory that is being lost, it is what is know as virtual memory. When a program get assigned a megabyte of memory by the operating system it may or may not be getting an actual megabyte of physical memory. It could be getting assigned space in the page file instead, or a mix of the two. This is why the pagefile exists, and it is why adding up all the memory every program running on your computer at any specific time thinks it has assigned to it to may well be greater than the amount of RAM actually physically in the computer. Every program thinks it can have access to a single contiguous block of up to 2GB of memory (if using a 32 bit version of windows that has not had its settings changed from the default, but settings can be changed that can bump this up as high as 3GB; on a 64 bit version of Windows it is even higher at 4GB for a 32-bit program like Civ). Probably more than you needed to know...
 
Nothing scary happens it'll just crash the game and you'll have to run it again.

You probably won't notice it unless you play enourmous maps with lots of civs or big mods. If you do start getting Memory Allocation Failures, you'll just have to pick smaller mods/smaller maps. You may find the problems only happen in late game when it needs more memory so your only other option may be just to win quicker!
 
Back
Top Bottom