The Problem
The Out of Memory Error can have a big impact on your enjoyment of Train Simulator.
Look at it! It is perhaps the most hated message ever to desecrate the screens of people using the program. I have added a "prohibited" symbol to express my disgust and determination to stamp it out. Fortunately I seldom see it these days and it has become a rarity.
This guide has been written to help you banish it forever.
The Multi-Part Solution
The Out of Memory Error can be tackled in various ways, and all can work together to help prevent the error occurring.
Enabling Your Dedicated Video Card
Hardware-accelerated GPU Scheduling
Adjusting the Windows Paging File
Automatically Clearing the Paging File on Shutdown.
Clearing the Cache
Verifying the Integrity of Game Files
Turning Windows Game Mode Off
Fixing Corrupt Workshop Scenarios
Don't forget that running certain other programs in the background (for example a memory-hungry web browser like Chrome) can sometimes have an adverse impact, so it is wiser to close them before running the game.
Enable Your Dedicated Graphics Card
Make sure your video card is configured so that the game uses it rather than using the CPU's integrated graphics. Otherwise your game will not make use of your video card's memory.
Here's how. In the Windows settings (might be different or not even apply for versions of Windows earlier than Windows 11), Choose System > Display > Graphics and you should see the following dialogue window. Type RailWorks in the search box and you should see the 32-bit and 64-bit versions of the game.
Click on the one you want to check, choose options and then select 'High performance.'
Then save and exit.
Also open the control panel of your graphics card and make sure it is enabled for both versions of the game (32-bit and 64-bit).
This ensures that the game will make full use of your video card's memory.
Hardware-accelerated GPU Scheduling
Turn on hardware-accelerated GPU scheduling.
With Windows 10 May 2020 update, Microsoft introduced a new GPU scheduler as a user opt-in, but off by default option. With the right hardware and drivers, Windows can now offload most GPU scheduling to a dedicated GPU-based scheduling processor.
To enable hardware-accelerated GPU scheduling using Windows 10 or Windows 11 Settings, follow this procedure:
Open Settings
Select System > Display tab.
Locate Multiple displays
Click on Graphics Settings.
Select the Change Default Graphics Settings option.
To enable the feature, toggle ON the button next to the Hardware-accelerated GPU scheduling.
Reboot your Windows device to apply the changes.
The Windows Paging File
Very often, the issue causing the Out of Memory Error message can be prevented simply by adjusting the minimum and maximum size settings of the Windows Paging File, which is part of the Windows operating system.
The paging file can expand the amount of system-committed memory, or virtual memory, that a system can utilise.
The paging file extends the RAM’s capacity, as it stores RAM data that has not been used or accessed lately. Additionally, operations that exceed your system's physical RAM space are automatically sent to the paging file to be stored to free up RAM. A paging file can be read as a connected chunk of data from RAM, which is much faster than reading the data from multiple locations.
All computers need a paging file, whether you have over 64 GB of System RAM, or just 4 GB, as Windows may need it for important processes that may not be immediately apparent. Train Simulator also requires you to have a paging file and, without one set, it can directly affect the smooth running of the software.
As regards what settings to use for your paging file, there are several schools of thought.
The Dovetail Games recommended (Microsoft documentation) method.
The Mark Russinovich (Microsoft expert) method.
The Fixed Paging File method.
1. The first method (which is used in this guide) completely matches that given by Dovetail Games themselves in their Train Simulator Knowledgebase. You can check this out at the following link.
Managing Your Computer's Virtual Memory (Page File) In Windows [dovetailgames.freshdesk.com]
Under method 1, ideally your paging file size should be 1.5 times your physical memory at a minimum and up to 4 times the physical memory at most to ensure system stability. For example, say your system has 8 GB RAM. You can calculate your minimum paging file size with this equation: 8 GB x 1.5, and your maximum paging file size with this one: 8 GB x 4. The totals would be 12 GB and 32 GB of RAM respectively. Windows needs the figures in MB instead of GB and uses the binary interpretation for disk capacity, so multiply them by 1024. In the dialogue box you should enter the settings as 12,288 MB and 32,768 MB.
2. The second method recommended by Dr Mark Russinovich bases the ideal paging file size on the maximum total commit charge for the programs you like to have running at the same time. He says if you want to have some breathing room for potentially large commit demands, set the maximum to double that number.
You can check this out at the following link.
Pushing the Limits of Windows: Virtual Memory [techcommunity.microsoft.com]
Mark Eugene Russinovich is a Spanish-born American software engineer who serves as CTO of Microsoft Azure. He was a cofounder of software producers Winternals before it was acquired by Microsoft in 2006. He says some feel having no paging file results in better performance, but in general, having a paging file means Windows can write pages on the modified list (which represent pages that aren’t being accessed actively but have not been saved to disk) out to the paging file, thus making that memory available for more useful purposes (processes or file cache). So while there may be some workloads that perform better with no paging file, in general having one will mean more usable memory being available to the system (never mind that Windows won’t be able to write kernel crash dumps without a paging file sized large enough to hold them).
3. The third method involves setting both the minimum and maximum paging file sizes to double the expected normal maximum commit charge. By having the minimum and maximum sizes the same, you effectively create a fixed paging file which never changes size and is less likely to become fragmented. I have tested this method, and it seems to be adequate for me. However, its effectiveness will depend on your system.
Changing The Windows Settings
Now you understand the function of the paging file (Page File), here's how to optimise it.
Go to the Windows Start Menu and click on Settings.
Type performance.
Choose Adjust the appearance and performance of Windows.
In the new window, go to the Advanced tab and under the Virtual memory section, click on Change.
Deselect the Automatically manage paging file size for all drives box at the top.
Select the drive with your Windows operating system installed.
Click Custom and enter a size range. Suppose your system has 32 GB or RAM. Your minimum paging file size can be calculated by 32 GB x 1.5, and your maximum paging file size can be calculated by 32 GB x 4. That's 48 GB minimum and 128 GB maximum. The dialogue box needs the figures in MB, so multiply by 1024. In this example, the system has a minimum paging file size of 49,152 and a maximum size of 131,072.
Leave all the other drives alone.
Click Set then Ok.
That's it. Your Windows paging file has now been optimised for Train Simulator (and other games), and this should help prevent those horrible Out of Memory errors.
Automatically Clearing The Paging File
It is possible to automatically clear the Windows Paging File at shutdown.
This is optional, but some reports say this is a good way to prevent the Out of Memory error. Peter Hayes, who is somewhat of an authority on Train Simulator with years of experience, says "the reason the paging file tweak works is not due to its size change but moving it to a different part of your disk drive. Remember the Paging File retains data (corrupt or otherwise) when Train Simulator shuts down and preferably should be emptied each time Windows closes."
*Please note, in some cases this automatic method can slow down the computer shutdown/restart process.
Here are the steps:
Start Regedit. (do this by typing regedit in the Windows Search box and clicking on Registry Editor)
Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
Find ClearPageFileAtShutdown from the list on the right.
Right click on it and select Modify.
Change the value to 1 to enable.
Reboot your computer.
Clearing The Cache
It has been found that clearing the cache can greatly reduce the occurrence of the OOM error.
Clear the cache either before you start playing or editing, or after you finish.
You can do this via the Train Simulator settings/tools menu after the game loads.
It is also possible to clear the cache outside of the game - either before or after using Train Simulator. There is a very helpful guide to show you how to do this, written by Mavadelo
Clear Cache outside game
Click the above link to find out about it. I use it all the time.
Verifying The Integrity Of Game Files
Besides the paging file optimisation and clearing the cache, verifying the integrity of your game files can also prevent the Out of Memory error.
Verify Integrity of Game Files when you still have the OOM error or indeed any other unexplained problem..
It can be done via the Steam Library Page.
First right click on Train Simulator to bring up the dialogue, then select Properties
Now choose Local Files and then Verify Integrity of Game Files
Turning Windows Game Mode OFF
This is not directly related to the Out of Memory Error, but it can have an impact and also interfere with the smooth running of Train Simulator.
Although enabling Game Mode should usually prioritise games and minimise background tasks to improve performance, many games encounter poorer frame rates, stutters, and freezes.
In my experience, Train Simulator is one of these games, so I strongly advise you to turn Game Mode off.
Open the Start menu, select Settings, choose Gaming, Game Mode and under its settings turn Game Mode OFF.
Also under Gaming, choose Captures and make sure Background recording (Record what happened) is OFF - unless of course you actually need to do such recording.
These changes should help to improve performance and result in better and smoother gameplay for Train Simulator, and may help prevent the OOM error.
Similar advice for Microsoft Flight Simulator is given at this website:
Flight Simulator Blog - Best Graphics Settings Guide [www.flightsimulator.blog]
Fixing Corrupt Workshop Scenarios
Those who encounter the Out of Memory Error and who cannot even start the game may in fact have a corrupt workshop scenario file on their system.
It is often recommended that they unsubscribe and delete their latest subscribed scenarios one by one until they can get the game restarted.
However, methodically unsubscribing from the scenarios in this fashion is not the best cure. It is much better to identify and deal with the specific scenario(s) causing the problem. You will find your workshop subscriptions under the following folder:
Program Files (x86)\Steam\steamapps\workshop\content\24010\
The well-known community contributor Cyclone has written excellent, clear and detailed instructions on how to proceed from here, so I shall simply provide the link:
Dealing With Corrupt Workshop Scenarios [forums.dovetailgames.com]
He very kindly informs me that if anyone has questions related to the handling of Workshop scenarios to avoid corrupt scenarios, he can possibly answer those questions.
------ OTHER ------
Our Other Guides
Here's the list of our other guides available for Train Simulator
Route Building Essentials +
How to Make a Quick Drive Scenario
The TS20xx Player's Troubleshooting Guide
Workshop Scenarios Menu - Enhanced
Workshop Routes Menu - Enhanced
Link to a Route's Workshop Scenarios
All Route ID Numbers - Including Workshop
All Steam Store DLC in Alphabetical Order
Creating and Importing Custom Scenery
Give This Guide A Thumbs Up
If you have found the above advice and information useful, please rate this guide by giving it a thumbs up - and of course don't forget to add it to your favourites.
Thank You For The Awards
I would just like to say a very big thank you for the generous awards people have bestowed on this guide. Your kindness is most encouraging and the awards are very much appreciated.
Copyright
This guide © Copyright Warwick Rail 2021,2022, all rights reserved.
Source: https://steamcommunity.com/sharedfiles/filedetails/?id=2297125586
More Train Simulator guilds
- All Guilds
- Train Simulator 20XX Achievements List
- Train Simulator Guide 9
- Using RealTimeTrains
- Editing the camera position for a better view - no extra tools needed
- [ENG] TS2015 - Controls Overview
- Driving and Firing Steam Engines
- Train Simulator - UK Commuter Rail Guide (Tips and Tricks)
- Train Simulator - How to Get the Correct Picture When Posting a Scenario and Else Tips
- Train Simulator - Guide to Creating and Importing Custom Scenery