SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH4 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=219)
-   -   Dumb Question:What does the 4 gig patch do? (https://www.subsim.com/radioroom/showthread.php?t=177503)

Bubblehead1980 11-28-10 04:32 PM

Dumb Question:What does the 4 gig patch do?
 
Noticed in downloads there is a 4 gig patch for SH 4, what does this do exactly?

Webster 11-28-10 10:09 PM

i think its for windows XP so it uses all 4 GB of ram instead of the 3GB limit of XP


EDIT: i was wrong . . . read post below

Tonga 11-29-10 12:24 AM

From the author's commentary on the program:

Quote:

This very little tool patches x86 executables in order to let them have 4GB (instead of only 2) of virtual memory on x64 platforms. This tool comes very handy for applications which need a great amount of virtual memory like games, 3D renderization, multimedia etc. To gain these 2GB, you just have to use this tool to patch the executable (*.exe file) of the software you want to have these additional GBs of virtual memory. It can be used by clicking on it and choosing the file or through command line (e.g.: "4gb_patch file.exe"). It automatically creates a backup copy of the original executable.

Why things are this way on x64 is easy to explain. On x86 applications have 2GB of virtual memory out of 4GB (the other 2GB are reserved for the system). On x64 these two other GB can now be accessed by 32bit applications. In order to achieve this, a flag has to be set in the file's internal format.



This flag defines whether the file is allowed to access more than 2 GB or not, so it just comes down to a very small simple change - but one with great effect.

irish1958 11-29-10 10:26 AM

Quote:

Originally Posted by Kpt. Hess (Post 1543405)
From the author's commentary on the program:



This flag defines whether the file is allowed to access more than 2 GB or not, so it just comes down to a very small simple change - but one with great effect.

To clarify, is that for XP, 32 or 64 bit only or does it pertain to Vista/Windows7, 32 or64 bit also?
Or to state the question another was, what operating systems should use the 4Gb patch, and which do not need it (for SHIII, IV, V)?

Tonga 11-29-10 11:10 AM

The patch is only intended to be used on x64 Windows platforms (XP64, Vista64, Win7 64), since 32 bit operating systems usually have another default setting concerning the virtual memory allocation. As a standard, x86 based OS can only recognize and use up to 4 GB of virtual memory. Per default, 2 GB would be allocated to the kernel and 2 GB to user programs, which is absolutely fine for most purposes like office stuff, mailing and also many games etc. The downside however is that you might have some programs that would need more virtual memory than the operating system actually allows them to get. For these cases (e.g. like a heavily modded SH3), you can edit the boot.ini file and add a NT-kernel switch which forces the system to alter its distribution balance to 3 GB for user programs and only 1 GB for the system.
The boot.ini file is usually hidden unless you explicitly check the checkbox for showing hidden system files in the folder options.

You might want to have a look at this post, Fubar2Niner was so kind to collect some examples of how to edit the boot.ini:
http://www.subsim.com/radioroom/show...54&postcount=6

However, keep in mind that the boot.ini is an important system file and should only be edited with particular caution. Some basic info on the boot.ini: http://en.wikipedia.org/wiki/NTLDR

Due to the 2 GB limitation described above, 32 bit exe-files have the flag "can use > 2 GB" unchecked in their internal file format, so that they can never use more than 2 GB. 64 bit systems however are capable of working with more than 4 GB and therefore this flag actually means that it only limits the file and cuts short possible performance increases. The patch now just changes this flag setting and allows the file to use more than just 2 GB.

So, in general, the 4GB patch should be applied if you intend to run these games in an 64 bit OS environment. For 32 bit operating systems you would have to use the 3 GB kernel switch.

ZigmundFreund 11-29-10 12:43 PM

:woot:Very enlightening indeed! Thanks for sharing Kapitan Hess and Fubar2Niner of course!

You :rock:!

fred8615 11-29-10 05:38 PM

Let me ask this outright since I'm still not sure. I have Win 7 64 bit. Should I use this?

Madox58 11-29-10 05:52 PM

Especially on a 64 bit system.
Make a backup copy of the SH4.exe before you run the Patch.
Just in case.
But it only changes one byte so there should be no problems.

Jan Kyster 11-29-10 07:31 PM

Why would we use this for SH IV?
AFAIK we don't have issues with unstable or crashing SHIV due to lack of memory? Or at all? Don't ever recall it crashing... :hmmm:

Madox58 11-29-10 07:44 PM

If a program is limited to how much memory it can use?
It could cause stutters, slow actions of many kinds, etc.........
If it can reach more memory?
It can work better in many ways.
Some ways would save read and writes to your HDDs.
If you need it, use it.
If you have no issues?
Don't use it.
Give it a try cause you can always get rid of it.
Or you may give a report to answer all questions that will henceforth be called...........

Jan Kyster's
'After testing the 4 Gig patch thingy? Here's the low down!'

:har:

And I am not being mean or sarcastic incase you wonder.
:salute:

Tonga 11-29-10 08:01 PM

Quote:

Originally Posted by fred8615 (Post 1543791)
Let me ask this outright since I'm still not sure. I have Win 7 64 bit. Should I use this?

I also have Win 7 64 bit. You can give it a try, absolutely. The patching tool should make a backup by itself, but as privateer said, make sure you have one.

Quote:

Originally Posted by Jan Kyster (Post 1543838)
Why would we use this for SH IV?
AFAIK we don't have issues with unstable or crashing SHIV due to lack of memory? Or at all? Don't ever recall it crashing... :hmmm:

I myself only found some improvements concerning SH3, a better overall performance, almost no program crashes etc. any more. However I did never experience that much of an improvement with SH4, so I guess it really depends on the system one uses. SH4 is indeed quite stable, but with SH3 that's still a different story. There you would never go without...

Just on a side note - there are other games that may also profit from this patch. German Truck Simulator for example now rewards me with almost 15 fps more since I patched the exe. Saint's Row 2 also shows a better fps performance (about 15-20 fps more on my notebook here). I am still testing this with Battlefield 2 and several mods as well as with GTA 4. The most obvious effect you might notice is a considerable decrease in loading time.
As long as you always make a backup, testing this with other games might prove quite useful.

Sailor Steve 11-29-10 08:02 PM

Some time ago I went out and bought another two GB of memory. Now I find out I wasted my money, as my system is 32 bit.

Oh well.

Madox58 11-29-10 08:06 PM

The patch I posted here is only for SH4 version 1.5
That was done to avoid problems with the Programmer of the Universal Patcher and permissions.
And was also done in a way that works well for SubSim.
Since the Patch here is only for SH4 version 1.5?
(And the SH3 versions)
The downloads are targeted.

Jan Kyster 11-29-10 09:08 PM

Right, done some testing now.

Before each test, these steps were followed:
- boot system
- wait 3 mins for W7 to settle :D
- load Process Monitor
- run the SH4.exe (made two: SH4-ORG.exe and SH4-LAA.exe)
- start process monitor
- play a bit
- exit SH4
- read Process Monitor

Test 1, standard TMO career, approaching harbour for attack, 9 ships in play.
Test 2, run single mission "Tokio-Saipan Convoy", 23 ships in play.

Screenshots of Process Monitor.

Test 1, org. and patched:
http://i189.photobucket.com/albums/z...SH4-ORG-T1.jpg

http://i189.photobucket.com/albums/z...SH4-LAA-T1.jpg


Test 2, org. and patched:
http://i189.photobucket.com/albums/z...SH4-ORG-T2.jpg

http://i189.photobucket.com/albums/z...SH4-LAA-T2.jpg


For Process Monitor and (another) LAA-program: http://forums.techpowerup.com/showthread.php?t=112556

I notice, the CPU barely breakes any sweat... http://i189.photobucket.com/albums/z...s/biggrin3.gif


Conclusion:
I found no difference, but at least it didn't crash SH4. Seems to run unaffected.
Would like to test, if someone has a mission with a humongeous load of ships... :shifty:


"Hey! It's only a drill!"
http://i189.photobucket.com/albums/z...A/LAA-Test.jpg
.

Jan Kyster 11-30-10 08:49 PM

An interesting update!
 
Thought of making a really heavy mission with quadzillions of ships, but then it struck me! The OM Museum!
Always known as a "Not To Be Used!" option because of crash!


So loaded OM with all stuff and quite right - SH4 crashed.


Here's the Process Monitor screendump.
Note how the max. memory use do not exceed 1.65 GB! but it still crashes...

http://i189.photobucket.com/albums/z...org-MUSEUM.jpg


Now the LAA patched SH4 Process Monitor screendump:

http://i189.photobucket.com/albums/z...laa-MUSEUM.jpg




Conclusion:
Reason for SH4 crashing in Museum, is because of the 2GB limitation. Using the LAA patch now allows for opening the museum.
Max. memory 2.21 GB for OM! :rock:



However, the sea is very strange.
Like high speed water flow... but of course, noone has ever seen it before... :D



Been running with the LAA patch for some 10 hours and have found no side effects, so I would say it's safe to use.
And if you would like to see the Museum, it's a must have!



/edit, note re. memory use.

Extra memory used for 9 to 23 ships = 1.40GB to 1.48 = 80MB
With Max memory = 1.65GB = crash, then we have 1.64GB-1.48GB = 160MB in real overhead.

Which is only twice of what required to meet 22 ships in the open ocean. No harbour, shallows, land etc.

All my installs now have the LAA patch. Imho it's a must have. Thanks for the hint, BubbleHead! :salute:

Core i7-930, 6GB, Win7 64-bit used in test.

Btw. Bubble, you should change the thread title to "[Solved] What does the 4 gig Patch do?"
It does nothing but good! http://i189.photobucket.com/albums/z...es/biggrin.gif


All times are GMT -5. The time now is 05:36 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.