Memory leak in TilemapLayerWebGLRenderer
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- javascript
- Ambito
- performance, web-dev
Direzione di ricerca
Inizia da src/tilemaps/TilemapLayerWebGLRenderer.js ed esamina gli oggetti a livello di modulo e l’assegnazione di texturerData.frame.source.glTexture durante il rendering. Riproduci il ciclo con l’esempio fornito di creazione e distruzione di Phaser.Game, quindi verifica tramite misurazioni dell’heap che la memoria trattenuta da TilemapLayerWebGLRenderer non aumenti più dopo cicli ripetuti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version
- Phaser Version: 4.0.0
- Operating system: MacOS Monterey v12.7.6
- Browser: all browsers
Description
When Phaser.Game is destroyed and a new instance is created on the same page, retained heap memory for TilemapLayerWebGLRenderer nearly doubles with each cycle.
Example Test Code (in phaser sandbox)
class MainScene extends Phaser.Scene {
constructor() {
super({ key: "MainScene" });
}
preload() {
this.load.setBaseURL('https://cdn.phaserfiles.com/v385');
this.load.image('walls_1x2', 'assets/tilemaps/tiles/walls_1x2.png');
}
create() {
const map = this.make.tilemap({ width: 200, height: 200, tileWidth: 32, tileHeight: 32 });
const tiles = map.addTilesetImage('walls_1x2', null, 32, 64);
const layer = map.createBlankLayer('layer1', tiles);
layer.randomize(0, 0, map.width, map.height, [ 0, 1, 2, 3, 4, 5, 6, 7 ]);
}
}
let game = null;
const getGame = () => game;
function createGame() {
game = new Phaser.Game({
type: Phaser.AUTO,
width: 800,
height: 800,
backgroundColor: '#111111',
scale: {
mode: Phaser.Scale.FIT,
autoCenter: Phaser.Scale.CENTER_BOTH
},
scene: [ MainScene ]
});
}
function destroyGame(gameInstance) {
gameInstance.events.once('destroy', () => {
game = null;
});
gameInstance.destroy(true);
}
setInterval(() => {
if (!getGame()) {
createGame();
} else {
destroyGame(getGame());
}
}, 6000);
Additional Information
Possible issue at src/tilemaps/TilemapLayerWebGLRenderer.js :
Module-level singleton retains glTexture reference across Phaser.Game instances. Declares two module-level objects that persist for the entire lifetime of the JavaScript module (i.e. they are never GC'd).
During every render call, the live glTexture from the active Tileset is written into texturerData:
texturerData.frame.source.glTexture = tileset.glTexture;
When WebGLRenderer.destroy() is called (via game.destroy()), it correctly iterates glTextureWrappers and calls .destroy() on each. However, texturerData.frame.source.glTexture is never nulled out.
- Lingua principale
- JavaScript
- Stelle
- 40.7k
- Fork
- 7.2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di phaserjs/phaser
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
I maintainer di solito rispondono entro 3 giorni
-
Type definition for TilemapLayer.getTileAt is wrongForse già presa @hkbughk l’ha presa 34 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 3 giorni
-
Shader.preDestroy leaks its ShaderQuad's vertex buffer and VAO on every create/destroy cycle (4.2.1)Forse già presa @k1epg01ng129-eng l’ha presa 32 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 3 giorni
-
Black opaque background on transparent Phaser.Text textures in Phaser 4.2.1 on older iOS WebGLForse già presa @SamuelMalmfors l’ha presa 14 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
phaserjs/phaser#7392 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di phaserjs/phaser
Issue simili
-
enhancement ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
DCGM/semant-demo#708 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
agents area: runtime automation chore cli consistency dependencies developer-experience difficulty: easy documentation enhancement good first issue help wanted hygiene json-output priority: P3 starters tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Client codegen: an import repeated in an impl file is emitted twice, and the browser rejects the moduleForse già presa @MalithaPrabhashana l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
jaseci-labs/jac#10756 ·
I maintainer di solito rispondono entro 1 giorno