Jump to content

How remove Canvas2d object creted after PIXI.Graphics on use generateCanvasTexture


www.taras
 Share

Recommended Posts

Hi , question about GC or how i can clean canvas2d object after use method  generateCanvasTexture
game use PIXI.WebGLRenderer - only

PixiJs version 4.8.2 (this my pain, but i can`t up pixijs to v5)

on class 
this.data:PIXI.Graphics
this.view:PIXI.Sprite
....
on sometimes i need redraw data on view
this.texture =this.data.generateCanvasTexture(PIXI.SCALE_MODES.LINEAR,1);
this.view.texture = this.texture;

on next time try to clean  this.texture, remove from 

PIXI.Texture.removeFromCache 
this.texture .destroy(true);
delete this.texture ;
 

but debug console in Safari (tab Canvas) show all Canvas wich  created on method generateCanvasTexture, but they never destroyed on memory 

How i can do clean up memory on it?

Link to comment
Share on other sites

"this.texture.destroy(true)" should work. PixiJS removes lins from its cache, destroys WebGLTexture. If you see something lingering - please specify where exactly is that lingring, what is the path from root node.

If you save a link to canvas somewhere - PixiJS wouldn't be able to "free" it. Its just not possible. Well, actually it is with "canvas.width=1; canvas.height=1;" but we dont have that code in our lib, we just nullify links to it and destroy webgl objects.

Edited by ivan.popelyshev
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...