Skip to content

[GEN][ZH] Fix memory leaks within various AIAttackStateMachines #1351

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Mauller
Copy link

@Mauller Mauller commented Jul 23, 2025

This PR cleans up memory leaks within a few different AI state machines.

@Mauller Mauller self-assigned this Jul 23, 2025
@Mauller Mauller added Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour Memory Is memory related Fix Is fixing something, but is not user facing labels Jul 23, 2025
@@ -735,6 +736,8 @@ AIStateMachine::~AIStateMachine()
{
deleteInstance(m_goalSquad);
}

clear();
Copy link

Choose a reason for hiding this comment

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

This looks like it could change behaviour with what AIStateMachine does on clear?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah i just noticed that there is also the signal to the ai.
it could be that the changes here can disappear if the problem is just cleanup within the states themselves.

@@ -1998,6 +2001,7 @@ AIAttackMoveStateMachine::AIAttackMoveStateMachine(Object *owner, AsciiString na
//----------------------------------------------------------------------------------------------------------
AIAttackMoveStateMachine::~AIAttackMoveStateMachine()
{
clear();
Copy link

Choose a reason for hiding this comment

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

Can you show what was leaking here?

Copy link
Author

@Mauller Mauller Jul 24, 2025

Choose a reason for hiding this comment

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

Various AIAttackstates that were appearing in the Generals shell map as being leaked after close.
I need to check back over it again later the same with the AIGuard state stuff.

Copy link
Author

@Mauller Mauller Jul 24, 2025

Choose a reason for hiding this comment

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

Checking it again, i think the issue is that the AIAttack states are leaking in a similar fashion to the guard states, i am going to repurpose this PR to implement their destructors and so that the other PR does not get too long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Is fixing something, but is not user facing Gen Relates to Generals Memory Is memory related Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants