Skip to content

Commit

Permalink
Destroy the PIXI objects to free GPU memory.
Browse files Browse the repository at this point in the history
I read that it is necessary to call destroy() to clean GPU memory as it is
not done automatically by PIXI. It seems to run more smoothly with this
change on my machine.

Signed-off-by: Arnaud Fiorini <fiorini.arnaud@gmail.com>
  • Loading branch information
arfio authored and bhufmann committed Apr 20, 2021
1 parent 40986f2 commit 7e59702
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions timeline-chart/src/layer/time-graph-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ export abstract class TimeGraphLayer {
}

protected removeChildren() {
this.children.forEach(child => this.layer.removeChild(child.displayObject));
this.children.forEach(child => child.destroy());
this.children = [];
}

protected removeChild(child: TimeGraphComponent) {
child.destroy();
const idx = this.children.findIndex(c => c === child);
idx && this.children.splice(idx, 1);
this.layer.removeChild(child.displayObject);
}

protected getPixels(ticks: number) {
Expand Down

0 comments on commit 7e59702

Please sign in to comment.