Pathoschild / SMAPI

The modding API for Stardew Valley.
https://smapi.io/
GNU Lesser General Public License v3.0
1.86k stars 263 forks source link

Memory leak leads to OutOfMemoryException in some cases #685

Closed Pathoschild closed 4 years ago

Pathoschild commented 4 years ago

Some players report OutOfMemoryException errors since the Stardew Valley 1.4.2 release (see timeline below). Once it started happening, previous versions of SMAPI and Stardew Valley were retroactively affected.

Reports

report game SMAPI CP log
2019-12-05 hiabara on Nexus
(asset reload issue)
1.4.2 3.0.1 1.10.1 log A and B
2019-12-12 Alvaror on Nexus
(asset reload issue; on Discord says started c. 8th)
1.4.2 3.0.1 1.10.1 log
2019-12-12 Spartan69 on Nexus
(asset reload issue)
1.4.2 3.0.1 1.10.1 log
2019-12-24 snesknees on Nexus
(return to title issue)
1.4.3 3.0.1 1.11 log
2019-12-28 mihihia on Nexus 1.4.3 3.0.1 1.11.1 log
2019-12-29 buckminst on Nexus 1.4.3 3.0.1 1.11.1 log

Timeline

date event
2019-11-26 Stardew Valley 1.4
SMAPI 3.0
Content Patcher 1.10
2019-12-02 Stardew Valley 1.4.1
SMAPI 3.0.1
Content Patcher 1.10.1
2019-12-04 Stardew Valley 1.4.2
2019-12-05 first report
Pathoschild commented 4 years ago

Tested scenarios:

This happens even if I strip out SMAPI's content pipeline, so it's not strictly related to asset handling. It doesn't happen if I run SMAPI with all features and APIs stripped out, so it's something in the SMAPI code.

Esca-MMC commented 4 years ago

Per my comments in Discord, this seems to be an issue in every build of SDV + SMAPI I've managed to test. I first noticed some memory leakage in October or November of 2019. Task Manager reports ~20MB more memory each time I open the "Load" menu, and ~60MB more each time I load any saved game. The results are similar with or without any mods.

I've tested the following versions and experienced similar leak rates:

As you mentioned, this could be a persistent (but previously benign) memory leak or a result of more recent Windows updates. These specific results happened in Windows 10 Pro, Build 18362 (last updated in July 2019).

Pathoschild commented 4 years ago

Fixed in develop for the upcoming SMAPI 3.1.