Page 1 of 2

[32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-01-18 06:54
by BloodyDeed
TL;DR: This will fix many memory related CTD errors on 32Bit operating systems.

1. Introduction
There has been a lot of confusing on this matter lately so I will try to clear things up.

We have to make a difference between the Large-Address-Aware-Flag and the /3GB Bootparameter (WinXP) or increaseuserva (WinVista/7). While there are often understood as the same they are not and its important to know the differences.
Additionally keep in mind that the bootparameter only affects you if you are using Windows 32Bit whilst the LAA-Flag can also be used on 64Bit operating systems.
It can solve many CTD issues to set the bootparameter but keep in mind: NEVER apply /largeaddressaware to the BF2.exe, more to that later.

2. /3GB Bootparameter / increaseuserva
Note: Both names describe the same functionality, /3GB on Windows XP, increaseuserva on Windows Vista/7.
Windows divides all your memory (RAM) in Userspace and Kernelspace.
On Windows 32Bit 2 GB are used as Userspace and the remaining 4 GB minus Userspace as Kernelspace.
This means EVERY program can use a maximum of 2 GB RAM.

However, Windows provides a method to increase the Userspace to any value between 2048 (2 GB) and 3072 (3 GB) megabytes in decimal notation.

In comparison a 64Bit operating system usually allows any program to use the full 4 GB, so the following steps are NOT needed if you use Windows 64Bit.
Note: both parameters can cause trouble in case 1 GB kernelspace is not enough. This problem occurs in particular when using an integrated graphic unit (common used in notebooks).

a) Windows XP: How to setup the /3GB Bootparameter
  1. Select "My Computer" with a right-click and choose "Properties"
  2. Click the Advanced tab.
  3. Switch to the "Startup and Recovery" area and press "Settings"
  4. In the System startup section, click Edit.
  5. It should automatically start Notepad displaying the Windows boot.ini
  6. In the "Operating Systems" section, add /3GB to the end of the line that includes /fastdetect
  7. Don't forget to save the changes and close Notepad and all open dialog boxes.
  8. To let the changes take effect restart your computer

b) Windows Vista/7: How to setup increaseuserva Bootparameter
  1. Navigate to Start>All Programs>Accessories>
  2. Right-click "Command prompt" and choose "Run as administrator"
  3. A command line window should open
  4. Type in "BCDEdit /set increaseuserva 3072" (without quotation marks) (Screenshot)
  5. 3072 is the maximum, "2560" or "2816" is in most cases sufficent.
  6. To let the changes take effect restart your computer


3. Large-Adress-Aware-Flag
Giving programs the opportunity to use it doesnt automatically make them use it :P
32 Bit Applications (which are most of you are using, so is BF2/PR) need a special flag to be set, so they know they can allocate more than 2 GB.

Fortunately most of the modern game developers know this tweak and implemented this flag by default.
So does Battlefield 2 with the latest 1.5 patch.
Keeping that in mind there is no need to modify the BF2.exe and for this reason it won't get explained in this tutorial.
Fiddling with your game's .exe is not recommended for online games anyway as some Anti-Cheat Tools might kick you for manipulating it.

Thats it. I hope this clears things up a bit and might be a help to some of you.
Thanks to karambaitos, for his thread about this and the screenshot.

Cheers
BloodyDeed, PR Support Team

Disclaimer: Use the steps above at your own risc, the PR Support Team won't be responsible for any damaged caused.

Sources: [1], [2], [3]

Re: [32Bit XP/Vista/7] Allow applications to use > 2GB RAM

Posted: 2012-01-18 19:13
by karambaitos

Re: [32Bit XP/Vista/7] Allow applications to use > 2GB RAM

Posted: 2012-01-18 19:19
by BloodyDeed
This thread is there to solve ANY misunderstandings regarding the largeadress aware functionality.
We got a lot of questions regarding this lately and people actually didnt know the difference between the bootoption and the flag.

Also this thread is the beginning of some greater restructure and cleanup of the support forum area.

I hope you dont mind if it some sort of replaced your thread, but this one got created by ourselves, so we are always free to edit and modify it related to PR/BF2.
I'm not sure if youre the real author or just quoting but this thread has also been created based on official support documents by Microsoft to ensure the things are true/correct and working.

Re: [32Bit XP/Vista/7] Allow applications to use > 2GB RAM

Posted: 2012-01-18 19:23
by karambaitos
nah, i dont mind, but if you are going to remove mine, add in screenshots on how to do it, since they help more than text, and what CMD is suppose to return once you press enter.
im actually glad that this is going to be stickied, it took me a year, before i finally found out how to stop 32bit crashes in PR, no one on the PR forums knew -_-


EDIT: with the boot.ini for xp its smart to make a back up, in case you screw up, so you can still start your windows up

Re: [32Bit XP/Vista/7] Allow applications to use > 2GB RAM

Posted: 2012-01-19 00:35
by MaSSive
If you get 64bit system you would never need it in first place ;)

We will add screenshots, as soon as we get time. As BD said we are working on complete cleanup of support section, and if you want to contribute with something, write a suggestion and we will revise it, and implement it. Sure we will credit you for it.

Cheers

Re: [32Bit XP/Vista/7] Allow applications to use > 2GB RAM

Posted: 2012-01-19 01:31
by LITOralis.nMd
XP screencaps:
Image

Image

Image

Image

Re: [32Bit XP/Vista/7] Allow applications to use > 2GB RAM

Posted: 2012-01-22 11:38
by fredo456
I tried to set 3GB's on 32bits XP (I have 4 installed) but at the restart of the computer, the screen resolution went back to 1280*700 instead of 1280*1024 and I felt that the graphic card (GT-240) was de-activated somehow, the windows were draging VERY slowly and the internet pages were lagging when I was scrolling to the end of it. I don't have an integrated graphic unit so I don't understand why I have so much trouble after the manipulation. Someone can help?

Posted: 2012-01-22 12:39
by BloodyDeed
Afaik your graphiccard uses shared memory.
That means it uses part of your RAM and the left over 1GB for the kernel arent enough.

Re: [32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-02-21 17:46
by fredo456
I changed my GT-240 for a Radeon HD 6850, but the strange effects after allocating 3GB's of RAM are still there. Can we allocate a value like 2.5 GB for instance?

Re: [32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-02-21 18:13
by LITOralis.nMd
Yes you can Fredo.
Weird things can happen,

Here is a general article on how to change boot.ini , MAKE SURE YOU BACK UP YOUR BOOT.ini BEFORE YOU START EXPERIMENTING ON IT.
How to edit the Boot.ini file in Windows XP

But you have to read this article for info on how this affects XP,
You have to fine tune the use of /3gb or /2.5g and the uses of userva, ...
Available switch options for the Windows XP and the Windows Server 2003 Boot.ini files
scroll down to the /userva section and read those articles..
How to use the /userva switch with the /3GB switch to tune the User-mode space to a value between 2 GB and 3 GB is important.

Basically, if you drop to 2.5gb using the /2.5GB switch, you might have to manually change the /userva switch to work with PR and any other big games/programs you use.

Re: [32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-02-21 19:39
by fredo456
Thanks a lot, it will be very useful! :-P

So basically, if I want that XP allows my programs to use 2.5Gb's out of four, I'm writin' /3GB /userva=2500 , I'm right?


EDIT: So I tried with that configuration but I'm experiencing the same problems, jerly windows moving/scrolling, laggy starting of the computer etc...

But are you sure that we can type /2.5GB in the boot.ini ?

RE-EDIT:

This time I wrote /2.5GB, the computer is working properly but 2.5Gb seems not enough as I CTD on Vadso City :-? ....

I really don't know what to do...

Re: [32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-02-21 20:46
by LITOralis.nMd
Yes, that's the usual outcome,
I have never had a hardware setup that needed the switch,
not sure what to do , you have to experiment and find if any work.
/2.6GB
/2.7GB
etc.

Re: [32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-02-21 20:49
by fredo456
I tried with /2.7GB, CTD on vadso, I'll try 2.8 and 2.9

EDIT:

Still crashing on Vadso with /2.9GB , guess I'll have to buy Windows 7...

Re: [32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-02-22 05:19
by SnipingCoward
[quote=""'[R-COM"]LITOralis.nMd;1736335']You have to fine tune the use of /3gb or /2.5g and the uses of userva, ...
Available switch options for the Windows XP and the Windows Server 2003 Boot.ini files
scroll down to the /userva section and read those articles..
How to use the /userva switch with the /3GB switch to tune the User-mode space to a value between 2 GB and 3 GB is important.

Basically, if you drop to 2.5gb using the /2.5GB switch, you might have to manually change the /userva switch to work with PR and any other big games/programs you use.[/quote]

I am pretty sure this "/2.5GB" thing is wrong.
I could not find any hint in your links that this would be a variable number. That and from knowing how I write command line parsers this "/3GB" is a toggle switch. Which means either you set it or you don't. Nothing in between.
You can use the /userva=xxxx switch for more precise tuning of user and kernel virtual memory space in the Windows Server 2003 family. Use this new switch with the /3GB switch in the Boot.ini file to tune the User-mode space to a value between 2 and 3 gigabytes (GB), with the difference (3,072 less xxxx) being returned to Kernel mode. Note that xxxx is expressed in megabytes (MB).
Refers to the "/userva=xxxx" setting.

Furthermore:
/userva
Use this switch to customize the amount of memory that is allocated to processes when you use the /3GB switch. This switch permits more page table entry (PTE) kernel memory but still maintains almost 3 GB of process memory space.

Note
Microsoft Product Support Services strongly recommends using a range of memory for the /USERVA switch that lies within the range of 2900-3030. This range is wide enough to provide a large enough pool of system page table entries for all currently observed issues. Usually a setting of /userva=2900 will provide close to the maximum available number of system page table entries possible./userva
Use this switch to customize the amount of memory that is allocated to processes when you use the /3GB switch...

This means you need to set "/3GB" and additionally to customize the memory structure you need to set /userva to a specific value as well.
[quote="fredo456""]So basically, if I want that XP allows my programs to use 2.5Gb's out of four, I'm writin' /3GB /userva=2500 , I'm right?[/quote]
Correct!




All that aside, I think you have got a broken driver or some broken hardware (RAM or GFX-Card). Your resolution resetting to something different indicates gfx driver issues. Mainly the actual driver is crashing. The slow scrolling in the browser originates from that. Have you seen the infamous "Display driver stopped responding and has recovered" message (not sure if XP has that one already)?
So the driver issues I would pin down to
  • the Drivers themselves (using beta ones?, run "chkdsk"),
  • the RAM (run memtests), and/or
  • the GFX card (can you replace it with an old/a friend's card?).
.
Checking the Event Viewer might give you some hints on whats really going on.

If you insist that all this is a RAM deficiency issue, run Task Manager and check the RAM usage. Process Explorer's "System Information" will give you a nice graph of your RAM usage. You can view the "Properties" of processes (i.e. BF2.exe) and see it's RAM usage (Performance tab). This can confirm your suspicions.

Re: [32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-02-22 12:02
by fredo456
Well I didn't see any message from Windows about drivers, but I when I set /3GB this message usually appears: "Not enough space on the registery, windows will no longer install anything on the registery" something like that since I changed my PC configuration few days ago. I did a huge clean-up with CCleaner of the registery but the message still pops-up.

I don't have enough time to test PR right now but I can tell you that the physical memory panel of the task manager indicates a total of 3.66 GB, a disponibility of 3.02 GB and a system cache of 1.11 GB, I only running google chrome, don't know if it helps. And I'm not using the 3GB switch.

And I think that with my old computer I had a memory value much closer to 4GB, more than 3.66GB that for sure.
Chkdsk found no problems.

Re: [32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-04-22 11:11
by pr|Zer0
Hello
Today, all of the blue, my editor crashed never to restart again. I mean I tried to open the editor and i get the "BF2memory.dll blah blah blah" error. Increased pagefile to 16Gb (Ihave 6Gb of RAM), used the 3Gb switch...no avail. Tried to open the editor with no resources loaded..nothing; just keep crashing on map load. Oh...and the last static added was the US hangar and also I was working to copy-paste a spline when the crash occured.
Now, heres the last dmp file for the editor(courtesy of win debugger):

Code: Select all

Microsoft (R) Windows Debugger Version 6.2.8229.0 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.


Loading Dump File [F:\Jocuri Instalate\BF2\dump\BF2Editor_v0.1.237.0_2012-04-22_14.02.04.dmp]
Comment: 'Battlefield2 MiniDump. Address: 00731FBC (In Windbg type: .ecxr)
ASSERT INFORMATION:
[...]
[EOF]'
User Mini Dump File: Only registers, stack and portions of memory are available

Symbol search path is: *** Invalid ***
****************************************************************************
* Symbol loading may be unreliable without a symbol search path.           *
* Use .symfix to have the debugger choose a symbol path.                   *
* After setting your symbol path, use .reload to refresh symbol locations. *
****************************************************************************
Executable search path is: 
Windows XP Version 2600 (Service Pack 2) MP (2 procs) Free x86 compatible
Product: WinNt, suite: SingleUserTS
Machine Name:
Debug session time: Sun Apr 22 14:02:05.000 2012 (UTC + 3:00)
System Uptime: not available
Process Uptime: 0 days 0:16:14.000
................................................................
.........................................
This dump file has an exception of interest stored in it.
The stored exception information can be accessed via .ecxr.
(bb8.c20): Access violation - code c0000005 (first/second chance not available)
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll - 
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for kernel32.dll - 
eax=00000000 ebx=00000000 ecx=00000011 edx=721c0dd8 esi=00000280 edi=00000000
eip=775ef8c1 esp=0018f0a8 ebp=0018f114 iopl=0         nv up ei pl zr na pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000246
[color=Red]ntdll!NtWaitForSingleObject+0x15:[/color]
775ef8c1 83c404          add     esp,4
Red code draw my attention. Anyway...any of those lines means anything to you?

Re: [32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-04-22 20:02
by MaSSive
fredo456 wrote:Well I didn't see any message from Windows about drivers, but I when I set /3GB this message usually appears: "Not enough space on the registery, windows will no longer install anything on the registery" something like that since I changed my PC configuration few days ago. I did a huge clean-up with CCleaner of the registery but the message still pops-up.

I don't have enough time to test PR right now but I can tell you that the physical memory panel of the task manager indicates a total of 3.66 GB, a disponibility of 3.02 GB and a system cache of 1.11 GB, I only running google chrome, don't know if it helps. And I'm not using the 3GB switch.

And I think that with my old computer I had a memory value much closer to 4GB, more than 3.66GB that for sure.
Chkdsk found no problems.

That is telling me that your system will inevitably crash in the future. You got something seriously wrong set there, and whatever you did restore it back to original. Especially message "Windows will not longer install anything in registry" means that whatever change you do to your system it will not be saved in registry and so it will be disregarded.

I found this while searching about it.

What to do about message windows low on registry space--The system has reached the maxium size allowed for the system part of the registry Additional storage requests will be ignored.

Edit: Link got messed up somehow cant find it again so here it is.
Solution to msg "LOW ON REGISTRY SPACE"

FIRST: If you've already gotten this message, download NTREGOPT (http://www.larshederer.homepage.t-onlin ... nt/faq.htm and run it. This will "compress" your registry and reduce the size greatly. This is the only "fix" I have found for this error. Using this program allows me to reboot and Windows still loads, if I do not use it, Windows does not load afterwards. I have not used the fix mentioned after this, and I don't think there is a point to using it. NTREGOPT works fine for me. Note that if this error message occurs on Windows XP or 2003 Server then the error is due to a currupted page file. These operating systems do not have a limit on the registry space. See the addendum at the end of this article.

Pls read this Article carefully and act with additional care (at your own risk) :
WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

By default, RSL is 25 percent of the size of paged pool. Setting up the size of paged pool (see PagedPoolSize value of the Registry key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Memory Management) also affects the size of RSL.

You can also manually set the RSL:


1. Run the Registry Editor (REGEDT32.EXE).
2. Locate the key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control.
3. Modify the value RegistrySizeLimit (create it first it if it does not already exist) to reflect the desired size, in terms of bytes.

NOTE: RegistrySizeLimit must have a type of REG_DWORD, and a data length of 4 bytes, or it is ignored. If you set the value RegistrySizeLimit to less than 4 megabytes (MB), it is forced up to 4 MB. If you set it to greater than about 80 percent of the size of paged pool, it is set down to 80 percent of the size of paged pool (it is assumed that paged pool is always more than 5 MB). If you set it to 0xffffffff the maximum size allowable (or 80 percent of paged pool, up to 102 MB) is set.
4. Shut down and restart Windows NT for changes in RSL to take effect.
Note A system restart is required after the RSL has been increased either through the graphical user interface (GUI) or the registry, because this change does not happen dynamically. If you do not restart the system, you may experience the following event:
Event Type: Error
Event Source: Userenv
Event Category: None
Event ID: 1000
Date: date
Time: time
User: NT AUTHORITY\SYSTEM Computer: name
Description: RegLoadKey failed. Return value Insufficient system resources exist to complete the requested service for C:\Documents and Settings\ntuser.dat.
In Windows NT 4.0, and Windows NT 4.0, Terminal Server Edition, the maximum paged pool size is 192 MB, so RSL can be a maximum of 153.6 MB. For additional information, click the article number below to view the article in the Microsoft Knowledge Base: 142719 (http://support.microsoft.com/kb/142719/EN-US/) NT Reports Out of Resources Error When Memory is Available
In Windows 2000, the maximum paged pool size is approximately 370-400 MB, when you do not use the /3gb command-line switch (this makes the RSL greater than 296 MB). If you use the /3gb switch, these values remain unchanged from Windows NT 4.0. Additional Notes on RSL

RSL sets a maximum, not an allocation (unlike some other such limits in the system). Setting a large RSL will NOT cause the system to use that much space unless it is actually needed by the Registry. It also does NOT guarantee that that much space will be available for use in the Registry.

In Windows NT version 3.1, paged pool defaults to 32 MB, so the default RSL is 8 MB (enough to support approximately 5000 user accounts). In Windows NT 3.5, paged pool can be set to a maximum of 128 MB, so RSL can be no larger than about 102 MB (enough to support approximately 80,000 users; however, other system limitations might keep this number of users considerably lower).

RSL includes space in the hives themselves, as well as some of the Registry's runtime structures. Other runtime structures are either billed against standard quota, or are protected by size limits and serialization.

To ensure that you can always at least boot and edit the Registry if you set RSL incorrectly, quota checking is not turned on until after the first successful loading of a hive (that is, loading a user profile).

For all but a few domain controllers, RSL never needs to be changed.

The limitations imposed by RSL are approximate.
Solution Provided by MICROSOFT CORP.

Addendum (provided by drzcmajul)
The page file needs to be overwritten as it has been corrupted. Follow the following steps:
1. Enter System in control panel (classic view)
2. Click on the Advanced tab
3. Click the settings button under "performance"
4. Click the Advanced tab in Performance Settings
5. Click Change virtual settings
6. Choose No paging file on the settings and click Set
7. Exit and restart the computer.
8. Repeat the first five steps of these instructions.
9. Choose System managed size on the settings and click Set
10. When you exit you will be asked if you want to overwrite the previous page file. Allow this action.
11. Restart your computer. You will be rid of the error message. Also, your programs may run better.

@pr|Zer0

That is far more complex problem and is called a deadlock. Its also way over our tech support heads to deal with. Only thing I can tell you is to use 64bit OS, since you have 6gb of RAM and most of it is unused. And you actually need it to be able to run such applications that have high memory demands.

Re: [32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-04-22 20:19
by pr|Zer0
thing is i have win7 x64
also installed fresh copy on my laptop and same thing...could be something with the map itself, or more likely with an object on it.
editor crashed when copying a spline..i can load other maps, but not mine...deleted last objects added today...no avail

Re: [32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-04-22 20:20
by MaSSive
pr|Zer0 wrote:thing is i have win7 x64
also installed fresh copy on my laptop and same thing...could be something with the map itself, or more likely with an object on it
Win7 64bit? Then whats this?
Executable search path is: Windows XP Version 2600 (Service Pack 2) MP (2 procs) Free x86 compatible Product: WinNt, suite: SingleUserTS
Clearly says Win XP SP2 32bit.

But debugger is from WIn7 x64
Microsoft (R) Windows Debugger Version 6.2.8229.0 AMD64
This is weird...thats why I said its way over our heads :-P

Possible that youre running it in XP SP2 Compatibility mode? IF so dont, since it will cause RAM leaks and possibly cause this to happen.

Re: [32Bit XP/Vista/7] Fix memory errors / Allow applications to use > 2GB RAM

Posted: 2012-04-23 05:00
by pr|Zer0
I, indeed, run the editor in compatibility mode, with XP SP2. Didnt think on compatibility thingy.
Will try that and come back.
Disabled compatibility and i get DIrect X9C error...apparently i have to instal 09c version or higher for the editor to run...and I have directX 11.
Like I said b4, i was running th editor on both machines for 1 year with no issue, and now all of a sudden i got editor memory error
Is there anyway to see if any object(or missing object/texture etc) is causing trouble?