1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Possible MAF work around...

Discussion in 'Fall Further' started by Vehem, Feb 1, 2009.

  1. Vehem

    Vehem Modmod Monkey

    Joined:
    Nov 22, 2005
    Messages:
    3,219
    Given that my current machine is fairly old now (4 years, give or take a couple of replacement parts) and that some of the machines reporting the Memory Allocation Fault have more memory than the 2GB that it contains, it would appear not to be purely hardware related. One thing that this machine does have in its favour though is a generous swap file.

    Note: The following advice is intended for users who are fairly confident changing settings on their computers. It is aimed at XP users initially, and if feedback suggests that it helps - may be of value to others.

    ====

    By changing the size of your virtual memory swap file, you can effectively increase the amount of information you can hold at any one time. In theory Windows will resize that file dynamically, to give you enough, but in some cases this does not happen correctly or quickly enough.

    To change the amount of Virtual Memory (setting will effect Windows as a whole, not just Civ4):

    Control Panel>System>Advanced Tab

    Performance - Click Settings, Advanced Tab again
    Virtual Memory - Click Change

    Find which drive contains your current swapfile(s) and inspect how large it is. By default it should say "System Managed Size". Ensure that the drive has enough space, then set the size to be "Custom" and set Initial and Max to both be double your current amount of RAM - ie for 3GB, set the swapfile to 6000MB.

    =====

    If someone is able to attempt this with a known MAF causing game (MAF during Save/Load, OR tile redraw) and report back, it may be very useful to know.
     
  2. Thunder_Gr

    Thunder_Gr Emperor

    Joined:
    Dec 8, 2008
    Messages:
    1,362
    Location:
    Universe
    I have 1GB memory and 4.5 GB swap file. Unfortuanlly I get MAFS early. I do not get MAFS in FF2 or FF 0.43. So it must be something conserning the new code.
     
  3. xienwolf

    xienwolf Deity

    Joined:
    Oct 4, 2007
    Messages:
    10,589
    Location:
    Location! Location!
    I play on a fairly outdated laptop (and a tablet at that, so not built for games), and while I don't play myself, I do run tons of AI Autoplay games without MAFs. Only things I do special are windowed mode (which seems to enhance performance drastically) and quick moves / quick combat. I'd not suspect either to help, but yet I don't manage to reproduce most MAFs from computers far better specc'd than mine.
     
  4. [to_xp]Gekko

    [to_xp]Gekko QCT junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,943
    Location:
    Seyda Neen, Vvardenfell
    is this XP only, or could it help with Vista also?
     
  5. lordrune

    lordrune Prince

    Joined:
    Jan 1, 2008
    Messages:
    580
    I'm pretty sure the default swapfile settings with Vista are the best to use. But you could try the slightly tangential adjustment linked in this thread:

    http://forums.civfanatics.com/showthread.php?t=306422

    On my Vista 2 GB system, I used to get lots of MAF errors playing Rise of Mankind as did a number of other people - until I tweaked something, and they went away almost entirely - from memory this is what I changed.

    As Vehem infers, these errors usually aren't hardware related, especially on the more modern systems (and even probably a fair few 1 GB systems). I understand it a bit like this - windows just needs to be told to permit Civ 4 to have the extra resources it needs to run fat mods.
     
  6. [to_xp]Gekko

    [to_xp]Gekko QCT junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,943
    Location:
    Seyda Neen, Vvardenfell
    thanx, I had already used the method in that thread. I'm not getting MAF errors while playing, but the game crashes if I open a game, then go back to the main menu and start another one ( could be a MAF, not sure... )

    how do you run civ in windowed mode? I'd like to try that out and hope it improves performance :D
     
  7. lordrune

    lordrune Prince

    Joined:
    Jan 1, 2008
    Messages:
    580
    FF can't start a new game when there's already one loaded since the game was initialised - I'm 99.99% certain that its not a memory issue of any kind, probably logic of some kind (of course it could be logic related to memory allocation causing a conflict of some sort, but never mind that). I've grown used to working around it, by exiting back to desktop and then going back in when I want to start a game.

    Not sure about the windowed mode, I never tried that - just doesn't feel natural for me to play games inside a window.
     
  8. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    I'm always playing in the windowed mode. Makes modding a lot easier. You can activate it via the CivilizationIV.ini:

    Code:
    ; Specify whether to play in fullscreen mode 0/1/ask
    FullScreen = 0
    
    If you set it to "ask" instead of "0", you'll get a popup every time you start up civ4.
     
  9. [to_xp]Gekko

    [to_xp]Gekko QCT junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,943
    Location:
    Seyda Neen, Vvardenfell
    actually, it's not crashing anymore after Vehem's tweak. it might be just good luck, but it's nice anyway. thanx Vehem! :goodjob:

    @Jean Elcard: thanx, I'll try that out. :)
     
  10. [to_xp]Gekko

    [to_xp]Gekko QCT junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,943
    Location:
    Seyda Neen, Vvardenfell
    ack. this is what I get when I try to run FF in windowed mode. I wonder what's wrong :D
     
  11. Thunder_Gr

    Thunder_Gr Emperor

    Joined:
    Dec 8, 2008
    Messages:
    1,362
    Location:
    Universe
    A correction to my first post. I have 2GB of memory, sorry for the typo, but it shouldn't matter anyway.
    What is causing the MAFs must be a/some AI action/s. Instead of produsing a CtD, it can produce a MAF.

    @Xienwolf: I have posted a save game which is guarandeed to produce a MAF as soon as you press the end turn. You could not reproduce it on your computer?

    A suggestion that could work...Since windows do not report MAFs, the report must come from the program. You could search for the points that the program traps a Memory Allocation exception and start tracing back...
     
  12. Hawkwood

    Hawkwood Man-at-Arms

    Joined:
    Jul 12, 2008
    Messages:
    235
    Location:
    Denmark
    What if my current Max is higher than double my RAM? My RAM is 1GB but the current max is 3072MB.
     
  13. Vehem

    Vehem Modmod Monkey

    Joined:
    Nov 22, 2005
    Messages:
    3,219
    Aye - this one is a separate issue - don't think we've got a good handle on it yet, but we know of it and will be looking to sort it.
     
  14. DavidB1111

    DavidB1111 Not-so-smart Man

    Joined:
    Oct 29, 2008
    Messages:
    662
    Hmm, I have never gotten a MAF ever in FF or FFH. Not a single time. Now, Rise of Mankind, yes, my new computer hates me. :)

    A test for those who have recieved MAFs, play on Normal speed, a standard size map, with default civs. If you still get MAFs quickly, there is something weird going on...:)

    Try playing Rise of Mankind, see how long it takes you to get a MAF. I don't really know what else to suggest, other than stress testing it to see what it takes...Sorry.
     
  15. Vehem

    Vehem Modmod Monkey

    Joined:
    Nov 22, 2005
    Messages:
    3,219
    The MAF problem has always been largely dependent on the system. A reliable save for one machine may not produce any problems for another. The second idea is good, but the memory allocation for serialization and such is (so far as I understand it) part of the engine that is handled in the executable, not the DLL. As we have no access to the executable source, it becomes quite difficult to trace beyond that point.
     
  16. Thunder_Gr

    Thunder_Gr Emperor

    Joined:
    Dec 8, 2008
    Messages:
    1,362
    Location:
    Universe
    Yes, but, if you keep in mind that it is FF new code that should be causing this, you shouldn't need to trace that deep in the program. My guess is that there is a memory allocation recursing code somewere in the AI code that has been recently changed and this is causing the program to report a MAF, when there is not enough memory or when a 0(or negative) size memory is requested(Normally, the 0 size shouldn't cause any problems, but this is really depended on the programmer that coded the memory allocation functions).
    Perhaps a function returning NULL is passed as an argument for the memory allocation size, or, perhaps a freed pointer is passed as an argument for pointing to a variable that has the size of a block to allocate.

    This kind of thing is lots of a guesswork, espesially if someone does not have the code to check on. I am trying to help, and, hopefully, my guesswork will be of some use to you.
     
  17. [to_xp]Gekko

    [to_xp]Gekko QCT junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,943
    Location:
    Seyda Neen, Vvardenfell
    well it turns out it WAS good luck, since it still crashes when doing that after patch E. oh well, not much of a problem anyway.
     
  18. War Chicken

    War Chicken Warlord

    Joined:
    Jan 16, 2006
    Messages:
    260
    Location:
    Pfungstadt, Germany
    I've changed the place of my swap file and maximized it - Didn't help a bit.
    Btw...Can anybody tell me why I can't set it bigger than 4GB? - I've got WinXP pro, and have at least 35GB available for it...
     
  19. Vehem

    Vehem Modmod Monkey

    Joined:
    Nov 22, 2005
    Messages:
    3,219
    Kind of. The MAF exists in BtS - but is occurring more often in FF in recent versions. I think all the new data tracked by FF is causing it to reach whatever situation caused the original problem more quickly than it otherwise would.

    The ideal would be to fix the problem at the source (BtS exe), the easy option would be to remove the FF features that are taking up additional memory/save file size (a lot of features). The trick is finding something in between given that those two options aren't ones that we'd like to consider.
     
  20. Kael

    Kael Deity

    Joined:
    May 6, 2002
    Messages:
    17,401
    Location:
    Ohio
    There were major MAF problems with large mods prior to BtS. Mostly around the save/load process. Players were able to allocate more memory to Civ as a work around as well, it helped but didn't solve the problem.

    Gyathaar tracked down the problem and submitted the fix to Firaxis during the BtS beta. This thread is an excellent read (especially anything from Gyathaar): http://forums.civfanatics.com/showthread.php?t=224178

    It may also be worth pinging Gyathaar to get some direct advice and any more details on exactly what he did.
     

Share This Page