Jump to content

Deleting texture from memory


Recommended Posts



to prevent memory leak, I want to delete unused texture. What is the proper way to do it?

Let's say I created texture :


var button = PIXI.Texture.fromCanvas(canvas);


Later in the code i want to do something like this :


button.destroy(); // really delete texture from memory

button = PIXI.Texture.fromCanvas(canvas); //  newly created texture


Thanks in advance,


Link to comment
Share on other sites

yes exactly, thank you


EDIT: i  just tried it on bunny example-1 with no success.


function rem() {


i get message :


Uncaught TypeError: Object function (width, height, view, transparent) {

// do a catch.. only 1 webGL renderer..




} has no method 'destroyTexture'


any idea?

Link to comment
Share on other sites

have someone idea, what is causing  error mentioned above? abything that i'm doing wrong?

also, shouldn't be here :

PIXI.Text.prototype.destroy = function(destroyTexture)
    if(destroyTexture) {
this.texture.destroy(true); ??
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.

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.


  • Recently Browsing   0 members

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