1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

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

Discussion in 'Civ4 - Bug Reports' started by Slyflyer, May 26, 2007.

  1. Slyflyer

    Slyflyer Chieftain

    Joined:
    May 26, 2007
    Messages:
    14
    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
     
  2. Methos

    Methos HoF Quattromaster Super Moderator Hall of Fame Staff

    Joined:
    Jan 1, 2005
    Messages:
    13,100
    Location:
    Missouri
    If I'm reading this right, than technically you didn't fix the error, but are just allocating more memory for [civ4] to use.
     
  3. T.A JONES

    T.A JONES Chieftain

    Joined:
    Jan 22, 2006
    Messages:
    3,471
    ^^True but that still works for me, if it work I mean. I never heard of this approach in getting more memory/ Hes maxing my virtual memory with this technique No?

    How come it has to be 2G people only Huh? Think of all the 1.5 G people your excluding worse, The thousands of the 1 Giggers! they need it more don't you think? And about the poor 700n somethings, What do they do? (never mind the hapless 512's, their a lost cause man )

    Is this the same as increaseing you pagion file> How come I havn't heard this approach on this cool rundown ?
     
  4. Slyflyer

    Slyflyer Chieftain

    Joined:
    May 26, 2007
    Messages:
    14
    Well I learned this trick as i said from some other games where it worked. I decided to give it a try and it worked just fine. If you have less than 2 gigs of ram you could make it work, all you are doing is allowing the OS and game to address more than 2gigs worth of memory (whether its physical or virtual). It is stated that 2gigs is recommended simply because if you do this trick with less than that all you are doing is increasing your virtual memory on your hard drive. Some people have issues with that. Then again, in playing civ I doubt this slow down is even noticable as it is not a heavily intensive game compaired to many out today. All I know is this trick worked perfect for me and hopefully it will work for someone else :) It is NOT the same as increasing the pagefile. I tried that before hand and it did nothing. Thinking back its obvious just increasing the pagefile will not work because you still need to allow both the OS and the game to address more than 2048mb worth of memory space :)
     
  5. timmeh

    timmeh Chieftain

    Joined:
    May 28, 2007
    Messages:
    2
    Works great for me!

    Recently tried Giant Earth Map and was getting "MAF's" every 2/3 turns and now after playing few hours its fixed so i can finally finish it. :)

    My spec: c2d@3k; 2gb; 7900gto; vista ultimate 32-bit;

    THANKS!
     
  6. MusX

    MusX Chieftain

    Joined:
    Apr 17, 2006
    Messages:
    398
    Location:
    Poland
    kewl. will check this out

    for winXP 32bit you propably should edit C:\boot.ini and add maxmem to the command link of your OS:
    Code:
    [operating systems]
    multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect /maxmem=3072
    don't copy and paste whole code cause your system may not boot!! just add /maxmem=3072 at the end of line :D

    this is not working very well for me... i still getting some mafs. what could help me? my ram is 2gb, my virtual memory is set constant 4096-4096mb. i've added maxmem=3072 to boot.ini. and of course edited exe via cff explorer.
    it's still getting mafs :(

    post editied cause 4096 was wrong maxmem: "4096" -> "3072"
     
  7. Slyflyer

    Slyflyer Chieftain

    Joined:
    May 26, 2007
    Messages:
    14
    Don't use 4096 if you have a 32bit OS. This could be causing your problems because a 32bit OS does not know how to handle more than 3gigs worth of memory addressing. You must have a 64bit OS in order to run any number above 3072. If you have any question about what bit OS you have feel free to ask me, but chances are if you don't know you probably have a 32bit OS. If you have a 64bit OS (i.e. Windows XP Pro 64bit or Windows Vista 64bit) you should already know :) Try 3072 and see how it goes and also make sure you followed the steps exactly (unless you have XP, then use your boot.ini line, although I no longer use XP and am unable to try it myself to see if it works)!
     
  8. davidmarshburn

    davidmarshburn Chieftain

    Joined:
    Apr 4, 2006
    Messages:
    39
    this did not work for me. win xp, 2 GB physical memory. i tried /maxmem=4096 and 3072 in boot.ini, and i set the game executable to "know" about >2GB addresses.

    i was going to attach a savegame file, but the file is 819 KB, exceeding the forum limit of 500 KB for that filetype (or so the internets tell me). in the savegame, the game crashes immediately on save after the beginning of the next turn. this is played with the napoleonic europe mod here:
    http://forums.civfanatics.com/showthread.php?t=196505

    i really, really hate this bug now. it has ruined civ4/warlord for me by making every mod i've tried unplayable *grumpy*

    thanks for the suggestions, though! this was a promising trick to try!
     
  9. MusX

    MusX Chieftain

    Joined:
    Apr 17, 2006
    Messages:
    398
    Location:
    Poland
    winxp 32bit, my cpu is up to 64bit but my OS is 32bit so 64bit cpu doesn't matter here.
    ok. i've set 3072, same like davidmarshburn's said it's not work for me too. what with my virtual memory size (not only for OS but overall), is it right: 4096-4096? maybe if I would allocate another virtual memory on the civ4's partition, would it work faster/better?
     
  10. toft

    toft Chieftain

    Joined:
    May 18, 2005
    Messages:
    758
    Location:
    €urope
    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:
     
  11. MusX

    MusX Chieftain

    Joined:
    Apr 17, 2006
    Messages:
    398
    Location:
    Poland
    it seems to be working only for 64bit OS, anyone figure out how to use it on 32bit XP?
     
  12. Slyflyer

    Slyflyer Chieftain

    Joined:
    May 26, 2007
    Messages:
    14
    I am using a 32 bit OS and it works for me (granted its Vista not XP).

    With a mod this could be a whole different issue but SHOULD still work for it. What matters in this case is the EXE file that is used to launch the mod. If you can get me the name of that file I could tell you how to do it. If you load the mod from Civ itself it still might be launching a seperate EXE for that mod (I am not sure because I never messed with mods in this game). So get back to me on that and I will try and help you out.

    In short... Not only have I done the trick myself and have it working but my Pagefile is set at 3068mb on my primary hard drive (C:\). My other hard drives are not being used to store the pagefile or civ data. I dont know if that helps but try to create my memory situation as best you can :)
     
  13. davidmarshburn

    davidmarshburn Chieftain

    Joined:
    Apr 4, 2006
    Messages:
    39
    i load the mod from within civ (well, when i started the game; after that, i double-click the savegame to load it and the mod in one step). the mod folder contains no executables, only xml and stuff. the executable that shows up in the task manager is indeed CivIVWarlords.exe.
     
  14. MusX

    MusX Chieftain

    Joined:
    Apr 17, 2006
    Messages:
    398
    Location:
    Poland
    the same here. i use Giant Earth Map which has no exe's
     
  15. Gyathaar

    Gyathaar Warlock Retired Moderator GOTM Staff

    Joined:
    Nov 19, 2003
    Messages:
    3,744
    Location:
    Trondheim, Norway
  16. ERLoft

    ERLoft San Diegan

    Joined:
    Dec 31, 2001
    Messages:
    254
    Location:
    San Diego

    So, you're saying that this line which farther up looked like this:

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

    should look like this:

    multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect /3GB


    What needs to be done to the .exe file for the second requirement as listed in the link you posted above: "and the application .exe must be flagged as a 3-GB-aware application."
     
  17. Gyathaar

    Gyathaar Warlock Retired Moderator GOTM Staff

    Joined:
    Nov 19, 2003
    Messages:
    3,744
    Location:
    Trondheim, Norway
    Yes.. :)
    That is the stuff the program linked in the first post of the thread does
     
  18. TAfirehawk

    TAfirehawk WoC Team Manager

    Joined:
    Aug 25, 2006
    Messages:
    2,326
    Location:
    Florida
    The MAF has been very well documented in ViSa since the mod is over 800MB and Firaxis has been well informed of their problem in the EXE.....more memory helps but is not a solution. Don't get me wrong, I am for any and all possible ideas to reduce the MAF like we have a NCSaver routine that is a work-around for saving games that is a huge help to MAF's.

    Recently I got the MAF's to decrease by changing the Memory Priority to System Cache....which pushes more of Civ to the pagefile. Our testing has shown that most MAF's happen at a repeatable amount of free physical RAM is reached, but the amount varies from PC to PC.

    Also note that any MS OS after Win2k will have MAF problems....and the newer the worse it is besides Media Edition.

    I am not the one on the ViSa Modpack Team doing the MAF testing so my info might not be 100%, but the save routine work-around and System Cache setting the MAF is nearly eliminated for most people.....hopefully this change will help even more!!!!
     
  19. Gyathaar

    Gyathaar Warlock Retired Moderator GOTM Staff

    Joined:
    Nov 19, 2003
    Messages:
    3,744
    Location:
    Trondheim, Norway
    Yes.. there are 2 things that cause the MAF... one thing is if the system actually runs out of memory.. which this method will prolly help with.. (basically I believe it will if the game uses more than 1.5 GB of memory, and it then gets MAF error when you save.. or if you have low amount of memory... if you have less then 1GB of memory, you will more likely run into this limit than the 512MB limit mentioned further below)

    The other thing is there is a max limit for how large a single datastructure can be in memory.. this seems to be set in windows.. and varies depending on the OS.. (civ4 stores most of the save game data in a single datastructure while it compresses/uncompresses the data)

    It is possible that this method also change that max limit (of around 512MB) somehow on some versions of Windows (I expect that may very well be the case on 64bit OSes and Vista)
     
  20. TAfirehawk

    TAfirehawk WoC Team Manager

    Joined:
    Aug 25, 2006
    Messages:
    2,326
    Location:
    Florida
    On WinXP, I changed the BOOT.INI to the /3GB switch and modified the EXE, but Civ still won't use more than 2GB of total memory :(

    I pull up a 512x512 smartmap game which wants like 10GB of ram and it still pegs at 2GB limit.

    And thanks Gyathaar for pushing this to Firaxis....since they wouldn't listen to us before the v2.08 Warlords patch.....
     

Share This Page