m22spencer / BattletechPerformanceFix

Performance improvements and general fixes for HBS' BattleTech.
The Unlicense
22 stars 8 forks source link

Memory leak fixes #57

Open coledot opened 3 years ago

coledot commented 3 years ago

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.

CptMoore commented 3 years ago

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.

coledot commented 3 years ago

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?

CptMoore commented 3 years ago

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.