Do you get Memory Allocation Errors when saving?

snoochems

Prince
Joined
May 25, 2004
Messages
434
Hi all,

I like my large Civilization games. 18+ civs, huge maps etc. But when ever the game gets too large, I get this "Memory Allocation Error" when saving the game. This means that the save game is corrupt, and attempting to load it is futile. And it seems I'm not alone.

So if you play 10 turns of the game, and then save it, get the error (which occurs about 50% of the time), you've lost all those 10 turns. Meaning you've just wasted your time.

I've been led to believe from other members of the community that this error has nothing to do with your hardware or PC setup. If you're playing a large game, it not a matter of "if" you get the error, but rather "when" you get the error. Once the game save file gets to a certain size, the error will start occurring. (for me it was when the save file got to about 1800KB)

I've had this problem when playing Civ 4 on 3 different PC's, in pretty much all the large games I've attempted playing. The error occurs in all versions of the game, from the unpatched Civ4 to the fully patched Warlords. In other words, the problem has existed since the game was released, and since then, several patches and an expansion have been released too. So if the problem has been around this long, then why hasn't Firaxis fixed it??? That's what I want to know...

A comment from a Civ 4 tech support moderator has me believe that Firaxis does not know about this problem, despite the fact that many people have had experienced it, and complained about it.

So what I would like to do is to get the Civ community to tell Firaxis that the problem is real, and post in the thread in the Troubleshooting forum (link below). From what I've seen on just this forum, I've very much NOT alone in experiencing this problem. I would like to see it fixed with patch, or at the very least, fixed in the next expansion pack, 'Beyond the Sword'.

The link is http://forums.civfanatics.com/showthread.php?p=5364836#post5364836

You may have experienced this in normal game play once ending a turn, but it is very likely caused from the 'Autosaving' that occurs at the end of the AI's turns.

Regards,
Snoochems
 
Repeating what I said in previous thread...

This is a well-known problem.

Firaxis DOES know about this error. However, Firaxis says it occurs only in modded games, and they, you see, "don't support modding". So if this error had occured to you in an unmodded game, send the save file to Firaxis. Maybe they WILL do something about it in this case.

Well, I find that, when playing Huge maps 18 Civs 5/6 of the game run with no MAF's for me. When they start appearing, I just disable Autosaves and finish the game without closing Civ4. However, it is very annoying that you can do nothing else on your computer when finishing your game and being afraid to save it and exit Civ.
 
I've never seen this error, but I'm pretty sure there's a way 'around' this.

Edit your Warlords' CivilizationIV.ini file.

Find QuickStart (line 44) & UseLastMap (line 138 I think ... I'm also not in front of my gaming rig, so I can't open the .ini files to verify the line number or name).


I turned AutoSaveInterval (line 110) off and turned the two settings above ON.

What this does is set up CivIV so it never saves your game to hard-n-fast file. It just dumps the memory somewhere at the end of every turn. Without even needing to save, Civ opens the last game right back up for you to pick up where you left off.

I did this to prevent myself from even being able to reload or not complete a game, but I presume since this error seems to have something to do with saving, it might circumvent it ... who knows.?
 
I have been getting this error, and I have NO mods. It was installed direct from the CD and online patcher, and no mods or any other changes or files have ever been used.
 
I've never seen this error, and I've played many huge map games with as many additional civs as possible.
 
largedarryl. What sizes are your savegames at. This error most often start to occur when the savegames reach 1800+ kb. If you have had alot of 1800+ kb savegames and never got this error, consider yourself lucky and congratulations :)
 
largedarryl. What sizes are your savegames at. This error most often start to occur when the savegames reach 1800+ kb. If you have had alot of 1800+ kb savegames and never got this error, consider yourself lucky and congratulations :)

Others say that they get the error when the save file reaches about 1400kB.

Why would firaxis choose to look at the problem because it occurs in mods is beyond me. I thought they were all for supporting the mod community. Besides, I've had this error in both mods, custom maps, and standard games.
 
Others say that they get the error when the save file reaches about 1400kB.

Why would firaxis choose to look at the problem because it occurs in mods is beyond me. I thought they were all for supporting the mod community. Besides, I've had this error in both mods, custom maps, and standard games.

Because from a programming standpoint, a mod could potentially be 100% different from the base code and Firaxis would have no idea what's going on in this new foreign code. Asking someone else to fix your problem is something that programmers dont like to do.

Now on the other hand, if this is happening in Warlords, then something should be done by Firaxis.

I'm not quite sure I understand the problem here. The saves are corrupt? I get memory allocation problems when playing, but never when saving. Then again, my computer cant support maps over Standard size, so my saves arent that big. The easy fix to memory allocation problems is quite simple... buy more memory. Haha. But seriously. Memory allocation is annoying.
 
If you get the MAF when you are trying to save it will corrupt that specific savefile.

To avoid getting totally ripped on your game one can use two savegames and save every turn taking "turns" betwenn the two saves. Once you get MAF when saving a game it will corrupt that save but since you saved on a different save the turn before you can still reload.
 
If you get the MAF when you are trying to save it will corrupt that specific savefile.

To avoid getting totally ripped on your game one can use two savegames and save every turn taking "turns" betwenn the two saves. Once you get MAF when saving a game it will corrupt that save but since you saved on a different save the turn before you can still reload.

you don't think i've thought of that. But when you're in the middle of a large war, a turn could take 5-10 minutes. On top of that, it takes a long time to load the game if it does crash. Which it does about 50% of the time.

:mad:
 
you don't think i've thought of that. But when you're in the middle of a large war, a turn could take 5-10 minutes. On top of that, it takes a long time to load the game if it does crash. Which it does about 50% of the time.

:mad:

I basically answered ac196..... guy and than talked some about MAF to no one in particular in case you got offended :confused:

I know what you mean. It is a pain as soon as the MAF starts coming most of the turns. Than you could just quit that game... sadly...
 
I get them occasionally (ok I've changed quite a bit of stuff in my own game), but I did get them before...I'm almost 100% certain it's not anything I've changed.

And I've got 2GB RAM so hmmmm.....
 
I have been looking at this some, and the problem appears to be that there is some kind of max limit for how big a a single datastructure (in this case a C++ steam) can be when stored in memory.
The max limit appears to differ depending on what version of windows you are running.
So the problem has nothing to do with how much physical memory or swap you have (assuming you dont actually run out ofcourse), but has to with an artificial limit in windows.

So basically the fix has to be to continiously steam the data to and from disk while compressing/decompressing the data instead of reading savegame data into memory first.
 
I have been looking at this some, and the problem appears to be that there is some kind of max limit for how big a a single datastructure (in this case a C++ steam) can be when stored in memory.
The max limit appears to differ depending on what version of windows you are running.
So the problem has nothing to do with how much physical memory or swap you have (assuming you dont actually run out ofcourse), but has to with an artificial limit in windows.

So basically the fix has to be to continiously steam the data to and from disk while compressing/decompressing the data instead of reading savegame data into memory first.

I am very interested in hearing any further investigation of yours in this problem. You have any hope of a solution without Firaxis releasing more code?
 
I tried to make a small program that makes a memory stream, and then adds one and one byte to it until it fails.. and then writes out how many bytes it managed to add..

code looks like this:
Spoiler :
Code:
#include <stdio.h>

#using <mscorlib.dll>
using namespace System;
using namespace System::IO;

int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
 	MemoryStream* memStream = new MemoryStream;

	bool val=true;
	int counter=0;
	try
	{
		while(true)
		{
			memStream->WriteByte(val);
			++counter;
		}
	}
	catch(...)
	{
	}


	char buf[2048];
	sprintf(buf,"Memory Limit:\n%d bytes\n%d kB\n%d MB\n", counter,counter/1024,counter/(1024*1024));
	
	MessageBox(0,(LPCTSTR)buf,"Stream Memory Limit",0);

	return 0;
}

On all my machines that run win XP Pro, it fails at 512MB.. I wonder if it fails before or later on other versions of window.
 

Attachments

I am not sure what is happening in my games. I have 2 gig of memory so it may not be the same. I get a crash back to desktop or worse, to a black screen. This happens several times a game and even when I have been diligent about saving the games, it is a pain (you know where) to continually have to reload or turn on the computer again.

I play huge worlds, 12 plus opponents, and no mods. I haven't been able to see a pattern of when this occurs.
 
Back
Top Bottom