| SimPE Tutorials > What to do if you get a System.OutOfMemoryException Error | ||
| tunaisafish | ||
Member since: 2006-01-08 From: Woop-Woop, Australia Posts: 76 | Several people were experiencing a problem of apparently running out of memory when they had plenty of real memory and swap space in their machines. Luckily for us, Buzzler also had this problem, as he knew exactly why it was happening :)
Buzzler kindly agreed to write this tutorial after solving the problem on his own machine. I now pass you over to him...
DISCLAIMER: Attention! The methods described in this lets-call-it-a-tutorial are by no means foolproof, entirely safe or whatever appropriate adjectives come to your mind. If you mess this up you could corrupt your system (the software part)! You've been warned! The ProblemNow that we got this over with let's begin. Say you're playing in a pretty big and old neighbourhood, have most or all of the EPs and use SimPE to edit said neighbourhood from time to time. Bad news for you because you're pretty much doomed to encounter an out of memory error in SimPE sooner or later the exact error message being "Exception of type 'System.OutOfMemoryException' was thrown". Be aware though that this does not really deserves to be called a bug it's more like reaching limits that weren't expected to be reached.
If you got the error and are done whining and cursing entities of choice, start the Task-Manager, hit the process view and then re-enact what you did to make SimPE spout the error message. Observe the memory usage of the SimPE process. Does it rise and rise and if the memory usage is at around 1.7GB (might be 1.6GB or 1.8GB as well) the error occurs? Congrats you've got what I'm talking about. Background InformationSkip this if you don't want to know what's going on.
A word about swap size or more correctly pagefile size - skip this if you don't want to know what this Buzzler whoever he is thinks about the world. If you encountered the mentioned problem and asked for help maybe someone recommended increasing the size of the pagefile. Probably someone even hinted the pagefile should be at least 1.5 times as big as the amount of physical RAM. Given the fact that the application runs out of memory at around 1.7GB of memory usage this is just plain nonsense. The size of the pagefile doesn't affect the above mentioned 2GB limit for 32Bit programs at all. And since the pagefile has to be addressed just like the physical RAM, do you think the size of the pagefile could have any effect on the 4GB address space limit of 32Bit operating systems? In fact if you got 4GB of RAM and a 32Bit OS the pagefile is pretty much of no use at all. And all these "facts" on how the pagefile should be 1.5 as large as the RAM were just nonsense to begin with, someone somewhere started it, it got repeated over and over again by people who have no clue how the memory management of a modern OS works and right now this "truth" can't be killed anymore even if you try to stake its heart. The SolutionOK enough nagging we want to get rid of the issue and yes there is a possible way but like stated above it is potentially dangerous and will pretty much definitely end in disaster if you don't do exactly what I say. Ok, now stand on one leg and bark like a dog! Well it was worth a try... Part 1. Windows ConfigurationThis part only applies to 32Bit operating systems so if you're running a 64Bit-Windows, you don't need to, you should not, you MUST not do this! Just skip all of the following and just read and do the part about the LAA-flag at the end. I stated above that Windows splits up his 4GB address space into 2GB for programs and 2GB for "kernel and executive services" but luckily this is not set in stone. Windows XP (C:\boot.ini)On Windows XP (and Windows 2000 and Windows 2003) there's a switch that can be set in the boot.ini to change the 2GB/2GB divide to 3GB/1GB. This is where the fun starts. Start Windows Explorer and open the root directory of the drive where your Windows is installed (C:\ for the most installs). If you don't see a file named boot.ini, then check your 'View' options. As this is the file that needs changing, also check that the file is not 'Read-only'. See the end of this doc if you need help with the Read-only or View options.
Double click on boot.ini to open it. Under [operating systems] should be a string that should look more or less like this: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Home dition" /noexecute=optin /fastdetect Copy it and insert it right below the original string - and copy it from your boot.ini not from this post! Add "/3GB /userva=2900" (without the quotation marks) to the inserted string and add something to the Windows and so on within the quotation marks for example 3GB so they can be distinguished at bootup.
Now the boot.ini should look something like this: [boot loader] Don't change anything in this multi(0)rdisk(0)... part because you'll make your system unbootable that way! If you now reboot your computer the boot menu should pop up giving you the choice between the two possibilities, the first one is your normal unaltered 2GB/2GB-Windows and the second is the altered 3GB/1GB-Windows. Windows VistaIf you use Vista 32Bit the above method is not possible sadly enough. I found this alternative:
To enable the 3GB switch on Windows Vista
To turn off the 3GB switch
Since I don't have Vista I couldn't test this and I said sadly because unlike the method for XP there's no safety net but if you run into any problems and can't turn off the switch the regular way, you should still be able to safe boot your machine and then disable it. Part 2. The LAA-FlagNow we have Windows where we want it. It is able to provide up to 3GB of memory to 32Bit programs (64Bit OS's can by default provide up to 4GB to 32Bit programs) but the programs have to explicitly state that they're able to handle more than 2GB of memory or Windows won't provide them more. This is where LAA (large address awareness) comes into play.
Now SimPE is able to handle more than 2GB of RAM and the out of memory problem should be history, for now.
| |
Member Controls
| SimPE Tutorials > What to do if you get a System.OutOfMemoryException Error | ||
| tunaisafish | ||
Member since: 2006-01-08 From: Woop-Woop, Australia Posts: 76 | ||
viewpost, 30088, 0