-
Notifications
You must be signed in to change notification settings - Fork 739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interaction Menu - fix a crash when loading savegames #7115
Conversation
Thanks @Dystopian :) |
Most inherited actions were for CAManBase (from medical) 117 Units After |
This will break WIP #6295 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalization
Co-Authored-By: commy2 <[email protected]>
When merged this pull request will:
Currently any mission with sufficiently enough soldiers placed crashes when loading a savegame, because the game runs out of memory when deserializing arrays.
The addInteractionToClass function from interact_menu with allowInheritance flag set adds an (retroactively applied) Init event handler to the object class for every added action, so the actions can be added to descendant classes of the base class the action was added to.
ACE Medical adds a lot of actions to the CAManBase base class.
This means ~250 more Init events on CAManBase when Medical is loaded.
The array is referenced on every CAManBase object and thus creates a big save file, which cannot be loaded without running out of memory.
This PR rewrites the allowInheritance part of the addInteractionToClass function to drastically reduce the memory usage.
Realistically this is just a BI bug we will keep running into, but we can avoid it with this memory optimization.