You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When analysing the memory report I noticed that after closing the view with PIXI app I still see PIXI instances in the memory. Digging deeper into the chain, I noticed a common instance for leaked elements is renderGroup. Then I noticed renderGroup is cleared for elements in the Container.removeChild method:
On our end, we call the destroy method for app:
_pixi.destroy(true, {children: true, texture: true, baseTexture: true })
*_pixi - PIXI Application instance
Expected Behavior
renderGroup should be cleared for stage to remove references to other elements and let GC do its job.
Steps to Reproduce
Thing I would like to point out is that we are using a slightly unusual approach, we store PIXI on window, perhaps this is the reason why it keeps refs in memory, however it would be cool to clear the renderGroup for stage, this would be valid from my point of view.
To overcome this issue I remove references to elements manually this way:
_this.pixi.stage.renderGroup.childrenRenderablesToUpdate = {};
_this.pixi.stage.renderGroup.childrenToUpdate = {};
_this.pixi.stage.renderGroup.instructionSet = null;
However it would be great to do it directly in the destroy method of the Application.
Additional Information
Let me know if I missed something or there is already a solution for this issue. Thanks!
The text was updated successfully, but these errors were encountered:
Current Behavior
When analysing the memory report I noticed that after closing the view with PIXI app I still see PIXI instances in the memory. Digging deeper into the chain, I noticed a common instance for leaked elements is renderGroup. Then I noticed renderGroup is cleared for elements in the Container.removeChild method:
pixijs/src/scene/container/RenderGroup.ts
Line 188 in 78824e4
However for the stage element this method is not called as it has no parent:
pixijs/src/app/Application.ts
Line 207 in 78824e4
pixijs/src/scene/container/container-mixins/childrenHelperMixin.ts
Line 228 in 78824e4
On our end, we call the destroy method for app:
_pixi.destroy(true, {children: true, texture: true, baseTexture: true })
*_pixi - PIXI Application instance
Expected Behavior
renderGroup should be cleared for stage to remove references to other elements and let GC do its job.
Steps to Reproduce
Thing I would like to point out is that we are using a slightly unusual approach, we store PIXI on window, perhaps this is the reason why it keeps refs in memory, however it would be cool to clear the renderGroup for stage, this would be valid from my point of view.
Environment
pixi.js
version: 8.1.1Possible Solution
To overcome this issue I remove references to elements manually this way:
_this.pixi.stage.renderGroup.childrenRenderablesToUpdate = {};
_this.pixi.stage.renderGroup.childrenToUpdate = {};
_this.pixi.stage.renderGroup.instructionSet = null;
However it would be great to do it directly in the destroy method of the Application.
Additional Information
Let me know if I missed something or there is already a solution for this issue. Thanks!
The text was updated successfully, but these errors were encountered: