BattletechPerformanceFix icon indicating copy to clipboard operation
BattletechPerformanceFix copied to clipboard

Memory leak fixes

Open coledot opened this issue 4 years ago • 3 comments

First iteration of a set of fixes that aim to resolve memory leaks in the game.

This set of fixes targets mostly message subscriptions that are added but never properly removed. This inflates not only the size of the MessageCenter, but leaks a large number of objects by having references to them persist in the MessageCenter.

Saves ~70MB per contract that's been completed.

coledot avatar Feb 21 '21 17:02 coledot

Already asked for a dll in the other PR. I have small stutters after playing one map, that get progressively worse over time (rotation of your ship stutters ever so slightly) . I know memory leaks existed, but didnt really knew how to figure this out. This could be really helpful and might fix my stuttering.

CptMoore avatar Feb 22 '21 12:02 CptMoore

https://drive.google.com/file/d/1XthU7h6tmLR5xfpVqGC6Wjh4lGbExfQ7/view?usp=sharing

After renaming, you should be able to just drop-in replace it for the main .dll

To enable set "MemoryLeakFix" = true, in your settings.json

I'd be surprised if this particular fix addressed your stuttering, there are many other larger leaks to be plugged. But who knows for sure until you try it?

coledot avatar Feb 22 '21 16:02 coledot

Well the amount of message center subscriptions was probably the issue. Load save game into the campaign map. Quit to main menu, load same save again. Accelerate and see rotation.

Without your fix: small stuttering (would increase the more I load) With your fix: almost no stuttering (like after first load)

However i did have a floating mechicon (atlas) from the mechbay when switching screens during normal usage. That went away when switching to and away from the mechbay again.

CptMoore avatar Feb 22 '21 18:02 CptMoore