XCOM 2
Noire Nov 12, 2022 @ 8:55pm
Memory leak in modified game
It's worth saying right away that my PC has good parameters that are much higher than recommended for this game. Moreover, I used to use a large number of mods and didn't have similar problems, but at some point it started happening. Usually, closer to the middle of the game, my loading into the mission begins to become very long, after which the game crashes and a message that the system does not have enough memory. I do not know how to solve this problem and ask for help. No, don't suggest I turn off mods and play a vanilla game - it sucks. This has worked for me even on a weaker system in the past and I have not experienced memory issues throughout the game. It seems to have started since the advent of the 2k launcher, which broke all the mods and I started using AML. But this problem really bothers me. Are there any ways to remove the memory leak, or at least there are a number of mods that have a big impact on the game?
< >
Showing 1-15 of 16 comments
Dragon32 Nov 13, 2022 @ 4:09am 
Not sure about the crashing but try deleting some old save files, that can make loading quicker.
HazardHawk Nov 13, 2022 @ 10:58am 
Ironically, the base recommended spec level runs the game better than exceeding those specs. In fact, the more you exceed, the more memory leak you get.

That said, as well, when you start adding mods, you also escalate the memory leak, but not as bad as higher level hardware until it accumulates to being the same.

To answer your question specifically, cosmetic mods and skins hit the hardest. Open Task Manager, go to performance tab, click your GPU and see if 3D is at 100% If it is, your primary bottleneck is video memory. I solved my issue in this by adding a midgrade newer NVIDIA card alongside my High Quality AMD card. Go into settings for NVIDIA and set Physx to the Nvidia Video card. From that point it relieves that processing within the AMD card. Unfortunately, if you are running High Quality NVIDIA, it will not be supported by AMD the same and will not relieve any issues.

If you cannot lower the 3D rendering, dump the cosmetic mods and skins.

Another improvement I made was I had a 250GB SSD so I added it to my system and made the entire drive a page file limiting the C drive page file to 64MB (my system requires 64 but most average systems only require 8MB to 32MB. It is easily enough to see it being used looking in Task Manager and selecting that drive to see its activity levels.

From that point, to optimize, I had to underclock my AMD video front side bus and overclock my memory. Getting that balanced and then added to make that way by script when I launch XCOM 2, and I barely have any hesitations and slowdowns. Cannot fix that barely, as that is pure data transfer rates internally and I have no way to broaden or supplement the pathways. Have not tried it yet as I dont have eight free SSDs in two sets of four all the same size, but a friend is running four striped SSDs for Windows and four Striped SSDs for Steam and other installed programs and not hitting data transfer bottlenecks.
Last edited by HazardHawk; Nov 13, 2022 @ 11:00am
Noire Nov 13, 2022 @ 11:26am 
Originally posted by HazardHawk:
I have a pretty good video card with 12 gigabytes of memory
HazardHawk Nov 13, 2022 @ 11:39am 
Originally posted by Noire:
Originally posted by HazardHawk:
I have a pretty good video card with 12 gigabytes of memory
Computer Information:
Manufacturer: ASUS
Model: System Product Name
Form Factor: Desktop
No Touch Input Detected

Processor Information:
CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 9 5900X 12-Core Processor
CPU Family: 0x19
CPU Model: 0x21
CPU Stepping: 0x0
CPU Type: 0x0
Speed: 3700 Mhz
24 logical processors
12 physical processors
HyperThreading: Supported
FCMOV: Supported
SSE2: Supported
SSE3: Supported
SSSE3: Supported
SSE4a: Supported
SSE41: Supported
SSE42: Supported
AES: Supported
AVX: Supported
AVX2: Supported
AVX512F: Unsupported
AVX512PF: Unsupported
AVX512ER: Unsupported
AVX512CD: Unsupported
AVX512VNNI: Unsupported
SHA: Supported
CMPXCHG16B: Supported
LAHF/SAHF: Supported
PrefetchW: Unsupported

Operating System Version:
Windows 11 (64 bit)
NTFS: Supported
Crypto Provider Codes: Supported 311 0x0 0x0 0x0

Video Card:
Driver: AMD Radeon RX 6800 XT
DirectX Driver Name: nvldumd.dll
Driver Version: 31.0.12029.4013
DirectX Driver Version: 31.0.15.1748
Driver Date: 10 25 2022
OpenGL Version: 4.6
Desktop Color Depth: 32 bits per pixel
Monitor Refresh Rate: 143 Hz
DirectX Card: NVIDIA GeForce RTX 3060
VendorID: 0x10de
DeviceID: 0x2504
Revision: 0xa1
Number of Monitors: 3
Number of Logical Video Cards: 3
No SLI or Crossfire Detected
Primary Display Resolution: 1920 x 1080
Desktop Resolution: 7680 x 2160
Primary Display Size: 47.09" x 13.23" (48.90" diag)
119.6cm x 33.6cm (124.2cm diag)
Primary Bus: PCI Express 4x
Primary VRAM: 12287 MB
Supported MSAA Modes: 2x 4x 8x

It is not about HOW MUCH you have with XCOM 2, it is about components being balanced together.

NOTE: AND is primary video card.
NOTE: PCIe is supported to 8x, but I have it turned down to 4x to slow the data to better match the data transfer rates from the motherboard and read/write of the hard drives.
NOTE: DirectX is run by the Nvidia Card relieving the AMD of burden.
It should also be noted, the higher the grade of system memory and its capability, the more glitches it will cause in XCOM 2. It doesnt show here, but my 4800mhz memory had to be underclocked to 3200mhz to work for XCOM 2 in my system and it not be 2-3 minute freeze and then a slide show to complete a move.
Noire Nov 13, 2022 @ 12:27pm 
[quote=HazardHawk
[/quote]

omg. how difficult it all turns out. Are voiceover mods strongly influential on the process, or are graphic mods a big part of it?
Last edited by Noire; Nov 13, 2022 @ 12:28pm
HazardHawk Nov 13, 2022 @ 2:17pm 
Originally posted by Noire:
[quote=HazardHawk

omg. how difficult it all turns out. Are voiceover mods strongly influential on the process, or are graphic mods a big part of it? [/quote]
Graphics mods are the big ones. There is simply no way to overlay graphics without creating small errors.

Honestly, my head in in Warhammer 3 at the moment, but when I migrate back to XCOM 2 again, I am likely to start seeing if I can integrate mods into the main games files so it doesnt have to pull access from two locations.

OH, that reminds me, move all your mods to the WotC internal mod folder and that helps. That simply makes sure they are on a near part of the hard drive rather than having to go longer distances to find what it needs s if fragmented. ANYTHING that can help limit hard drive access is better.
Noire Nov 13, 2022 @ 2:24pm 
Originally posted by HazardHawk:
I created a new swap file on my SSD and installed a program to clean up RAM after every period of time, I didn't quite understand what "move mods" means, Aren't they in the game folder initially?
HazardHawk Nov 13, 2022 @ 2:57pm 
Program Files (x86)\Steam\SteamApps\workshop\content\268500 are where your mods are located.

Go to XCOM 2 in games list, right click yada yada, browse into the folder, if not one there, create a folder named Mods, open the Steam mod directory to that named folder, control A to select all, right click one folder, select copy, go to mods folder, right click, select paste, open AML, go to settings, add the mod path.

PERSONALLY, I removed the 268500 folder from content and the line in AML that points to it so that you only have the copies in the mod folders in your AML list.

I do not remember what I did not to have dual physical copies on my computer with one in workshop content and the other in XCOM 2 mods.
Noire Nov 13, 2022 @ 3:02pm 
Originally posted by HazardHawk:
Does it really have an impact on performance or is it just a guess? Anyway, thanks for the answers, I really can't play this without mods.
HazardHawk Nov 13, 2022 @ 3:22pm 
Originally posted by Noire:
Originally posted by HazardHawk:
Does it really have an impact on performance or is it just a guess? Anyway, thanks for the answers, I really can't play this without mods.
Help, yes. How much is going to depend upon your system and many other factors.

Common Layman type thinking.

You have a 1 inch rubber water hose. It is attached to a larger supply line and there are zero entry and exit restrictions so you have a smooth flow from entrance to exit for optimal delivery. THAT is ideal.

Now unbalance that with kinks, bends, twists, ballooning weak spots, and that is basically what we have as we are not playing on that old brand new system upon which this game was designed to play to which all its processes and transfer rates were balanced. Every place there is not a perfect match there is a slow down and turbulence in restriction or expansion to fill.

Can you take out enough rough spots to increase smooth flow? Yes, if you will really go to that effort. This will be the only game you have which will benefit from most of this and in underclocking it will affect other games the opposite in many cases.
Last edited by HazardHawk; Nov 13, 2022 @ 3:26pm
pmcmull Nov 14, 2022 @ 11:55am 
Back to the original post. System memory means the RAM that the CPU uses. I don't think you're going to find the answer in the video card. How often do you reboot your PC? Is it always on or do you just Sleep it without shutting down? Best way to reclaim memory is to shut down and reboot.
Also you can check memory usage in the Task Manager. Start it up while the game is running. If yo have only one monitor you may have to alt-tab to see it. Go to Performance tab and see what it says about the memory.
Hope this helps!
DarkWaterSong Nov 14, 2022 @ 1:33pm 
How much RAM do you haven and what other programs are running? Just I have 32 GB and I am good for around 9 GB at idle on win 10. I also have a 2 TB 980 Pro, so I rarely run into system memory issues due to a swap file or a page file getting to big.

Pst....yes that is something to check if you have less than 16GB of ram and smaller hard drive:

( https://www.windowscentral.com/what-swapfilesys-and-do-i-need-it-my-windows-10-pc )
Last edited by DarkWaterSong; Nov 14, 2022 @ 1:35pm
Noire Nov 14, 2022 @ 5:16pm 
Originally posted by DarkWaterSong:
Originally posted by pmcmull:

Thanks for the answer, but I think the problem is something else, I have 16 gigabytes of memory and I restart my computer quite regularly. This happens in a modified game at late stages, probably due to the number of mods used and I'm trying to solve this problem somehow
Last edited by Noire; Nov 14, 2022 @ 5:18pm
Mitzruti Nov 14, 2022 @ 6:28pm 
Given that you issue appears later in a campaign, this mod may help. it cleans up a ton of no longer necessary gamestates, resulting in smaller saves, less stuff it has to muck about with during strat-> tact etc.
https://steamcommunity.com/sharedfiles/filedetails/?id=2781621935

in the interest of science, how big are your saves getting when it starts crashing? (look in \Documents\My Games\XCOM2 War of the Chosen\XComGame\SaveData for them)

getting rid of saves from old campaigns can also help. because firaxis spaghetti.
Noire Nov 14, 2022 @ 6:41pm 
Originally posted by Mitzruti:
thx man i will try use it. I do ~5 namesaves + 3-5 autosave in game its not many i think.
< >
Showing 1-15 of 16 comments
Per page: 1530 50

Date Posted: Nov 12, 2022 @ 8:55pm
Posts: 16