-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
Hi,
I have found a memory leak when using the MobilePipeline on webgl renderer. The default MultiPipeline works fine and has no memory leaks.
I happens as soon asn you have a spine game object and any other game object. It will cause the render game.renderer.glAttribLocationWrappers to infinitely grow on very update.
You can see in a heap snapshot and compare the differences, this object keeps increasing.
I have code that replicates easily:
you can comment out the line to toggle between the Mobile and Multi Pipelines.
defaultPipeline: 'MobilePipeline' // Comment this out to use default 'MultiPipeline'import Phaser from 'phaser';
import { SpinePlugin } from '@esotericsoftware/spine-phaser-v3';
class Example extends Phaser.Scene {
preload() {
this.load.atlas('buttons', 'nine-slice.png', 'nine-slice.json');
this.load.spineJson('spineboy-json', 'spine/spineboy-pro.json');
this.load.spineAtlas('spineboy-atlas', 'spine/spineboy-pma.atlas', false);
}
create() {
// Need to have another game object
var button = this.add.nineslice(400, 300, 'buttons', 'button-bg', 400, 110, 64, 64);
button.setInteractive();
button.on('pointerup', this.onButtonPressed, this);
button.input.cursor = 'pointer';
button.setSize(100, 50);
const spineBoy = this.add.spine(500, 500, 'spineboy-json', 'spineboy-atlas');
spineBoy.animationState.setAnimation(0, 'idle', true);
}
onButtonPressed() {
console.log('button pressed');
}
update() {
console.log('glAttribLocationWrappers', this.game.renderer.glAttribLocationWrappers.length);
}
}
const config = {
type: Phaser.WEBGL,
width: 800,
height: 600,
backgroundColor: '#000000',
parent: 'phaser-example',
scene: Example,
render: {
autoMobilePipeline: false, // Disable mobile pipeline to force default
defaultPipeline: 'MobilePipeline' // Comment this out to use default 'MultiPipeline'
},
plugins: {
scene: [{ key: 'spine.SpinePlugin', plugin: SpinePlugin, mapping: 'spine' }]
}
};
const game = new Phaser.Game(config);I have the console logging, to see it increase in the Mobile Pipeline and it won't in the default one.
Metadata
Metadata
Assignees
Labels
No labels