Sign in to follow this  
Slaus

How to clean up Graphics.generateCanvasTexture() calls

Recommended Posts

Hello.

I'm drawing charts with Graphics.generateCanvasTexture() every frame. I need exactly canvas renderer due to antialiasing.

The problem is browser's memory usage going from 200Mb to 1.2Gb in mere seconds. Invoking texture.destroy() doesn't help. There was a talk about canvas creation memory leak and folks seemed to handle it somehow, but I can't figure out how they did :(

Is there any way to destroy such previously created textures or reuse them to create successive ones?

Thanks in advance ;)

Share this post


Link to post
Share on other sites

Thank you for your answer.

So I guess it's some trouble with releasing canvas objects which spawn on Graphics.generateCanvasTexture() calls? Maybe there is a way to release all the previously created canvas objects? I was looking to https://github.com/photonstorm/phaser/blob/v2.4.3/src/pixi/utils/CanvasPool.js photonstorm was suggesting in that thread, but there is no connection with PIXI, so I guess I'll have to patch Graphics.js somehow?

Share this post


Link to post
Share on other sites

Done! Memory usage is very stationary at ~200Mb. Thank you very much! But I don't understand your pessimism about "just moving problem to another domain". Is there something else I need to worry about? Relying on GC in untyped imperative language is the only way to go, I think ^^

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.