picture icon indicating copy to clipboard operation
picture copied to clipboard

fix memory leak

Open lightrabbit opened this issue 6 months ago • 0 comments

When the parent element and the child element use the same blendFilter, the backdrop in the blendFilter will be overwritten. The overwritten backdrop cannot be recycled by the RenderTexturePool, resulting in leakage.

The following is a simple example that reproduces the problem.

import * as PIXI from 'pixi.js';
import {Sprite, getBlendFilterArray} from '@pixi/picture';
// hacked sprite or tilingSprite
const sprite = new Sprite();
sprite.blendMode = PIXI.BLEND_MODES.OVERLAY;
// container with same filter
const container = new PIXI.Container();
container.filters = getBlendFilterArray(PIXI.BLEND_MODES.OVERLAY);

// add sprite as container's child
container.addChild(sprite);

lightrabbit avatar Aug 04 '24 14:08 lightrabbit