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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.