Page 1 of 1

When is Sequencer destoryed?

Posted: Mon Jan 31, 2022 3:28 pm
by VoodooDetective
I'm still trying to track down a couple memory leaks between levels. It looks like the Sequencers are mostly not destroyed (as far as I can tell?), and as a result the ActiveConversationRecord object sticks around between levels which also forces our character portraits (which are contained in atlases that contain the entire portrait animation set) to stay in memory.

I'm wondering if it's safe to add:

Code: Select all

            s_awakeSequencer = null; 
To:

Code: Select all

        private void FinishSequence()
        {
            m_isPlaying = false;
            if (FinishedSequenceHandler != null) FinishedSequenceHandler();
            if (m_informParticipants) InformParticipants(DialogueSystemMessages.OnSequenceEnd);
            if (m_closeWhenFinished)
            {
                FinishedSequenceHandler = null;
                Close();
            }
            s_awakeSequencer = null; 
        }
In Sequencer. Or would that cause issues? Is there a better way to handle this?

Re: When is Sequencer destoryed?

Posted: Mon Jan 31, 2022 3:58 pm
by Tony Li
Sequencer is a MonoBehaviour. You'll know it's destroyed when the Sequencer component disappears from the Dialogue Manager GameObject.

When a conversation starts, it adds a Sequencer component to the Dialogue Manager. When the conversation ends, it destroys the Sequencer component (with a one second delay for legacy reasons).

Is it possible that the dialogue UI is holding onto the image references? If a dialogue UI's subtitle panel or response menu panel portrait image still points to a character's portrait when the conversation ends and the dialogue UI goes inactive, then that portrait atlas will stay in memory.

Re: When is Sequencer destoryed?

Posted: Mon Jan 31, 2022 6:02 pm
by VoodooDetective
Ah so I do maintain references, but I clear them at the end of the conversation. I tried making the change I mentioned above, and clearing the static reference seems to have fixed the issue for me.

Will setting s_awakeSequencer to null in FinishSequence be a problem elsewhere, or should I be ok there?

Re: When is Sequencer destoryed?

Posted: Mon Jan 31, 2022 9:32 pm
by Tony Li
No, that's fine. I'll make the same change in 2.2.25.

Re: When is Sequencer destoryed?

Posted: Tue Feb 01, 2022 1:45 pm
by VoodooDetective
Oh sweet! Thanks very much!