Skip to content

Avoid keeping ActorInitializers in memory.#21448

Merged
PunkPun merged 1 commit into
OpenRA:bleedfrom
RoosterDragon:actor-init-gc
Jun 16, 2024
Merged

Avoid keeping ActorInitializers in memory.#21448
PunkPun merged 1 commit into
OpenRA:bleedfrom
RoosterDragon:actor-init-gc

Conversation

@RoosterDragon
Copy link
Copy Markdown
Member

The SupportPowerManager and WithSpriteBody trait captured the ActorInitializer in lambda expressions, which keeps it alive as long as the trait. The lambdas didn't need to capture the ActorInitializer, so rejig them to allow the ActorInitializer to be reclaimed after the traits have been created. As the TypeDictionary in the ActorInitializer can be quite large, this helps reduce memory usage.

The SupportPowerManager and WithSpriteBody trait captured the ActorInitializer in lambda expressions, which keeps it alive as long as the trait. The lambdas didn't need to capture the ActorInitializer, so rejig them to allow the ActorInitializer to be reclaimed after the traits have been created. As the TypeDictionary in the ActorInitializer can be quite large, this helps reduce memory usage.
Copy link
Copy Markdown
Contributor

@anvilvapre anvilvapre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

untested.

Copy link
Copy Markdown
Member

@PunkPun PunkPun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me

@PunkPun PunkPun merged commit 34a68cd into OpenRA:bleed Jun 16, 2024
@PunkPun
Copy link
Copy Markdown
Member

PunkPun commented Jun 16, 2024

changelog

@RoosterDragon RoosterDragon deleted the actor-init-gc branch June 16, 2024 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants