I Fixed The Maf Error... Here Is How!!

SupCom isn't large address aware by default (have download a "hacked" exe) but it shouldn't slow the system down any. Here and here is an interesting read on the subject.
 
Originally Posted by ERLoft
So, you're saying that this line which farther up looked like this:

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Micro soft Windows XP Professional" /noexecute=optin /fastdetect /maxmem=4096

should look like this:

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Micro soft Windows XP Professional" /noexecute=optin /fastdetect /3GB Yes.. :)

That is the stuff the program linked in the first post of the thread does
I'll trying now making it with Home Edition... i hope it will be the same :nuke:
 
Ok, this is my first post in these forums and the main reason is because like so many of you I had the MAF errors in Warlords which annoyed me so bad. I mean, how could I play high end games like STALKER and Supreme Commander and have zero issues but have Civ IV screw up. I am running on Vista Business 32bit and this fix is geared toward any Vista OS but will work in XP too as far as I am aware of. I acctually got the idea from a fix for Supreme Commander and FSX where there were nastly bugs of CTD errors when to much memory was being used. I decided to give the fix a shot for CIV and see what would happen.... what happened is 3 hours of smooth bug free play in Warlords when the whole map had been discovered! ;)

So here is my gift to you all.... enjoy! :D



Try this only if you have at least 2 GByte of RAM and at your own risk.

- First download the explorer from http://www.ntcore.com/exsuite.php

- Next make a copy of Civ4Warlords.exe. Than start "CFF Explorer" and open the orginal Civ4Warlords.exe file.
- Now go to NT Header/File Header and click File Header. There you will find a button labeld "click here". Click it. And select the checkbox "App can handle> 2gb adressest "
- Save the modified EXE, overwrite the orginal one. (Note in Vista you must be running CFF Explorer in Administrator Mode).

If you run Windows Vista 64 or Windows XP 64 youre ready to go and dont need to read on. The rest is only for Windows Vista 32 and maybe Windows XP 32bit.

- Now we need to make Windows Vista (32-Bit) ready to support more than 2 GByte.
- Open a command prompt with Administration rights. You find it under "Programs->Accessories->Command prompt" click right and select "run as administrator".
- Enter "bcdedit /set IncreaseUserVA 3072" (without quotes) in the command window and press enter.
After that restart windows
- For Windows XP there is a similar setting for the boot.ini, but I am not sure what it is, should be found be google.

ENJOY! :D

I've done this, and now I'm having a different problem... the MAF error seems to have been avoided, but this also seems to have created another. Simply put, after I load a certain saved game and play a few turns, as it's going to a new turn the screen goes black, the music stops, and a windows error message comes up (I'm running a 32-bit Windows Vista OS, btw) saying that the program has encountered a problem and needs to close...

This is happening consistently on the same turn, exactly two turns after I load this certain saved game, and it's just been happening since I tried this fix. Is there any way to fix this?

btw, I have 2048 MB RAM (which is the equivalent of 2 GB, unless I'm mistaken). So I shouldn't be having problems there, according to all I've read here. Is anyone else having this problem after using this fix, and has anyone found a second fix for it?

If not, then how can I just reverse what was done in this fix? (Ug... I really don't want to go back to the MAFs though...)
 
The fix doesn't go with the XP home edition (somebody "maybe" has already told this somewhere :) anyway i wanted to prove) so now i've passed to Beyond the Sword... I hope the problem is fixed there... and try to customize a my own mod beginning from the 40civ mod and joinig the EDU). I hope to begin to play some days...

Nope, sorry, they only included the codefix gaythaar supplied them(which is nearly the same as the savegame 500MB memory fix visa has)..doesn't fix the run out of memory issue(which also shows on your screen as MAF) but you do have 500MB more "time" before you hit the MAF..

I experienced it myself the moment i installed BtS...compiled the DLL to support autoAI, et voila, MAF...

BUT, the 64bit windows (which supports my 4gigs of RAM) did solve the MAF issue! huge maps, with many civs, go up to 2GB and over it(if the map is large enough) windows 32bit only allocates up to 2gb for ALL applications(meaning, if you have in the background many other programs running..well, do your math) as well as for some reason, video memory has to be substracted from the 2GB..dunno why, but it is as it is..meaning, in my case, i have a 512MB video memory card, 2gigs-512mb=1.5Gigs max application memory..substract other programs from it as well...meaning, hit the maf pretty soon, even with the savegame fix...

so either you use the 3gigs switch(i only know the vista 32bit 3gig fix works) which gives you 2.5gigs for applications(most huge games stay under this) to play..or you install a 64bit windows, which allows you up to 16Gigs of application memory(must be a mega mega mega game if you hit that boundary!)
 
Nope, sorry, they only included the codefix gaythaar supplied them(which is nearly the same as the savegame 500MB memory fix visa has)..doesn't fix the run out of memory issue(which also shows on your screen as MAF) but you do have 500MB more "time" before you hit the MAF..

I experienced it myself the moment i installed BtS...compiled the DLL to support autoAI, et voila, MAF...

BUT, the 64bit windows (which supports my 4gigs of RAM) did solve the MAF issue! huge maps, with many civs, go up to 2GB and over it(if the map is large enough) windows 32bit only allocates up to 2gb for ALL applications(meaning, if you have in the background many other programs running..well, do your math) as well as for some reason, video memory has to be substracted from the 2GB..dunno why, but it is as it is..meaning, in my case, i have a 512MB video memory card, 2gigs-512mb=1.5Gigs max application memory..substract other programs from it as well...meaning, hit the maf pretty soon, even with the savegame fix...

so either you use the 3gigs switch(i only know the vista 32bit 3gig fix works) which gives you 2.5gigs for applications(most huge games stay under this) to play..or you install a 64bit windows, which allows you up to 16Gigs of application memory(must be a mega mega mega game if you hit that boundary!)

:( :eek: :( :eek: :(
 
To the OP:

Wait, are you saying that if I do your fix on my Vista 32 I will see 4GB RAM when i see My Computer's Properties via right clicking INSTEAD OF 3GB of RAM? (I have 4 gb in my rig but vista only recognizes 3gb :( )

In other words, would your fix make my computer faster in my situation?
 
To the OP:

Wait, are you saying that if I do your fix on my Vista 32 I will see 4GB RAM when i see My Computer's Properties via right clicking INSTEAD OF 3GB of RAM? (I have 4 gb in my rig but vista only recognizes 3gb :( )

In other words, would your fix make my computer faster in my situation?

NO, that's impossible on a 32bit system! unless you have a memory management which works completely indepenend from the 32bit OS(win2000 for example)
any memory management that works on the 32bit OS system is limited to 32bit=2^32~4Gigs..meaning it can only allocate 4gig max! that includes ALL your memory(PCI cards, Graphical, all other memory of your devices attached to your computer) that requests OS allocation of memory.the OS can max 4gigs..it is as it is..you can't fix mathematics! type 2^32 on your calculator! :)

if your Vista only recognizes 3GB, it means that 1Gigs is already eaten up by graphic card or any other device on your computer that needs OS memory allocation..sorry, but it's the reason why i installed 64bit windows Vista!

Note, if you care to know: 64bit is mathematical speaking limited to millions times more memory then available at the whole planet, and more memory then needed to store the information of a human body(making "scotty beam me up" from startrek to become reality :p) but no CPU would be able to handle that right now..so 64bit is mathematical "unlimited for human experience" in reality limited on all OS's because of the CPU load to handle this. Vista is maxed to 16Gbyte I think..either way, doubt you'll ever find a piece of software in the near 4years to come that would need this.
 
NO, that's impossible on a 32bit system! unless you have a memory management which works completely indepenend from the 32bit OS(win2000 for example)
any memory management that works on the 32bit OS system is limited to 32bit=2^32~4Gigs..meaning it can only allocate 4gig max! that includes ALL your memory(PCI cards, Graphical, all other memory of your devices attached to your computer) that requests OS allocation of memory.the OS can max 4gigs..it is as it is..you can't fix mathematics! type 2^32 on your calculator! :)

if your Vista only recognizes 3GB, it means that 1Gigs is already eaten up by graphic card or any other device on your computer that needs OS memory allocation..sorry, but it's the reason why i installed 64bit windows Vista!

Note, if you care to know: 64bit is mathematical speaking limited to millions times more memory then available at the whole planet, and more memory then needed to store the information of a human body(making "scotty beam me up" from startrek to become reality :p) but no CPU would be able to handle that right now..so 64bit is mathematical "unlimited for human experience" in reality limited on all OS's because of the CPU load to handle this. Vista is maxed to 16Gbyte I think..either way, doubt you'll ever find a piece of software in the near 4years to come that would need this.

Ok... but someone told me that many programs may have problems with 64 bit... It'not good if i install a 64 bit only for ONE game....

2nd . i have a vista home premium never installed (i'm still using the xp home). could it be a 64 bit or it's a 32?
 
Ok... but someone told me that many programs may have problems with 64 bit... It'not good if i install a 64 bit only for ONE game....

2nd . i have a vista home premium never installed (i'm still using the xp home). could it be a 64 bit or it's a 32?

meanwhile, the MANY has changed into SOME! some programs still have difficulties, not to mention that vista 64bit has a complete 32bit emulation build-in(that actually works! unlike from what I've heard from XP 64bit-32bit emulator, but, that's only from hearing and saying, can't verify that)...only that running 32bit applications on a 64bit OS is without the 32bit memory restriction, since that's handled by the 64bit OS!

and to know if you use 64 or 32bit winXP...well, if your windows only recognizes 3GB out of 4GB, no need to ask, 32bit 100%!
if you wanna know for sure
start->settings->control panel->system ....now you can see wether your OS is 32 or 64bit..i dont have XP on my computer anymore so i only see it's there in my Vista-System window..but im very sure it must be there also on XP...just open your eyes :)

anyway, XP 64bit, im not sure, but I've read about compatibility issues with 32bit programs...but on my PC(with VISTA 64bit), I've tested Office, Corel, PS, Solidworks, DVD burning soft, Chatsoft, Civ, many other software...no problems! Can't test of course your hardware config+vista64bit+your software, but my guess...you won't have much troubles..vista has it's issues of course, but any problem you'll have, will most likely not be because of the 64bit version..
 
A lot of misinformation on this thread.

For one, 64-bit windows won't allow you to access millions of times more memory than 32-bit windows, for a 32-bit application like Civ4. Civ4 is hardcoded to use 32-bit pointers, so the most it can access is 4 GB, regardless of what OS it is using. Still 4 GB is better than 2/3 GB when using 32-bit windows.

The reason 32-bit Windows only allows up to 2 GB (or 3 GB with the switch) is not because ram is used by the video card, etc, but because the Kernel reserves the upper 2 GB for itself (this 2 GB is shared across all processes). The /3GB switch means the Kernel only reserves 1 GB. So in fact the difference between Win32 with /3GB and Win64 is not that much (although lesser fragmentation in the latter might significantly improve things when large chunks need to be allocated).

It's also not true that the 2 GB windows offers is shared between all process - rather each process gets up to 2 GB of virtual memory individually. So you can have many tens GB of allocated to applications. Of course, since you only have 4 GB of RAM, most of that would have to be swapped out and your swapfile would be very large.
 
Thanks for the correct information sanchez! :)
Indeed no OS can overcome the software limitations of course, and even if, windows 64Bit is limited to 16GB anyway(2^34) ...point we discussed here was that it theoritically would allow "unlimited" memory allocation...of course no hardware on todays market would even be possible to handle that amount of RAM...was just a theoretical thought how much 2^64 would be :)

sorry if you thought we actually claimed such hardware/software really existed, sure we know it doesn't! :)

as for the Video Memory. You don't understand what is said or it's said wrong. The Video ram is 100% substracted from the max amount windows can allocated(kernel+apps).
I have 4Gigs in my system, so i know! and really everyone, 100% of the people who have 4Gigs will confirm. the 4Gigs in your system, you have to substract the videomemory and other devices from the 4GB...what's left(usually something between 3 and 3,5gigs) is what's left for the kernel+apps..You claim this isn't the case, but i can assure you, put 4Gigs in your system, and watch with your own eyes! Suddenly your windows doesn't show you the 4Gigs anymore..I don't know all the technical terms to explain this, either way, the max memory windows show you in the system information is NEVER the 4gigs! on my system, it's the 4gigs-(video memory+some other devices)

in the case of civ, it meant, i had 3.4gigs left on my system, 2gigs for the kernel, so my app only got 1.4gigs (that's where i hit the MAF)..once i used the 3Gig switch, i still have only 3.4gigs left(because you're wrong, the video memory does need allocation from the OS) but now the kernel only takes 1gig, so i have 2.4Gigs left for apps before i hit the MAF(if you use the Largeadress fix presented on the first page in this thread, BtS has it enabled by default) either way, the video memory DOES take Allocations of your OS! i got that even from an MS technician!

It's also not true that the 2 GB windows offers is shared between all process - rather each process gets up to 2 GB of virtual memory individually.

Dunno this, don't have virtual memory :p too slow! who wants virtual memory? but thanks for pointing out that it's possible to have a 2nd program running in the virtual memory if needed.
 
sorry if you thought we actually claimed such hardware/software really existed, sure we know it doesn't! :)

No, I was just point out that it's a software limitation - no matter what OS you use, Civ IV 32-bit version (the only version that exists) will be able to address a maximum of 4 GB.

as for the Video Memory. You don't understand what is said or it's said wrong. The Video ram is 100% substracted from the max amount windows can allocated(kernel+apps).

In fact, it is true that PCI-E video cards and to a lesser extent AGP cards will map their video RAM into the 32-bit address space. It's not "subtraced from your RAM - just using some address space. For people with 3 GB or less of RAM, it's mapped to unused address above 3 GB. It's true, that in your case, with 4 GB RAM, you lose the use of the RAM which has been remapped to your card.

However, that's not the reason for the 2 GB limit, which was my point. The 2 GB kernerl/userland split has existed for at least a decade, back to when video cards had 1 MB of RAM and running up against these limits was unthinkable. Furthermore, that won't affect MAF, since it's only changing the amount of physical RAM available for mapping to user or kernel space addresses - it might make things slower, but it's doesn't limit how much memory you can allocate.

in the case of civ, it meant, i had 3.4gigs left on my system, 2gigs for the kernel, so my app only got 1.4gigs (that's where i hit the MAF)..once i used the 3Gig switch, i still have only 3.4gigs left(because you're wrong, the video memory does need allocation from the OS) but now the kernel only takes 1gig, so i have 2.4Gigs left for apps before i hit the MAF

That's not the way it works - your video RAM doesn't come out of either the application or kernel virtual address space - it's just less physical RAM to allocate between the two. Depending on how much the kernel is using, you may get the full 2 GB possible physical RAM available to your process even with a 1 GB card.

Dunno this, don't have virtual memory :p too slow! who wants virtual memory? but thanks for pointing out that it's possible to have a 2nd program running in the virtual memory if needed.

Everyone using a modern operating system has virtual memory - it's an unavoidable consequence of the way all modern hardware works. It doesn't matter if you set your swap to zero, you still use virtual memory (it just happens that the size of virtual memory == RAM in that case). There is no real advantage, and definitely a disadvantage to setting your swapfile to zero - for example, a much larger chance of MAF.
 
OMG IT WORKS!

I have vista x64 and 4gb ram... and this little nifty trick has done it all. Last week I played a game that got a MAF at every saveattempt. But because of this I have been playing 10 hours straight on that game - No more MAF! :goodjob:

This Really works I did it yesterday and i been playing all Night and Moring:goodjob: No sleep for me Or work "Yeah"
I also have vista windows x64 Ultimate No More MAF...I feel like i won the lottery only better.
 
Hi there, was wondering if it will fix this kind of error:

fatal error: memory allocation failure

I don't want to screw up my brand new computer...

I have 500GB hard drive
3B RAM

Thanks.

Cheryl
 
Hey, I'm playing a rediculasly huge map with 32 civs (mod). I'm on a new kick-ass PC, but are still experiencing memory issues such as units and improvements being invisible as I'm approaching modern ages.

Would this same technique also fix this problem?

(PS: I used this to fix MAF in Warlords so thanks for that!) :)
 
Top Bottom