Memory leak in Graphics.clear
See original GitHub issueI investigated this and figured out a fix already; I just wanted to file an issue first before making a pull request.
Repro: this is caused by repeatedly clearing a Graphics object and then calling drawRect
from WebGL. Rendering the Graphics object will call _renderSpriteRect
, which makes a new Texture that never gets destroyed, so the TextureUvs object that gets created is never dereferenced.
JSFiddle repro link: http://jsfiddle.net/yabm091r/3/
Solution: add this code to Graphics.prototype.clear:
if (this._spriteRect) {
this._spriteRect.destroy({texture: true});
this._spriteRect = null;
}
P.S. here’s a clip of me accidentally filing this bug with the title “tv” (my ctrl key wasn’t working): https://clips.twitch.tv/ArbitraryConcernedHamCharlietheUnicorn
Issue Analytics
- State:
- Created 6 years ago
- Reactions:28
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Memory leak in Graphics.clear · Issue #3869 · pixijs/pixijs
Repro: this is caused by repeatedly clearing a Graphics object and then calling drawRect from WebGL. Rendering the Graphics object will call ...
Read more >dwm.exe (Desktop Window Manager) Produces a Memory ...
Describes an issue where drivers newer than 27.20.100.8587 are causing dwm.exe (Desktop Windows Manager) to produce memory leaks.
Read more >Memory leak issue of Graphic Layer
I have a test program. There are 2 buttons. One button is used for adding 2000 graphics, the second one is used for...
Read more >Clear Graphic memory
VRAM will clear itself (Unless there is a memory leak in the game!). The only way to forcably clear the VRAM is to...
Read more >How to fix a memory leak caused by bufferedimage ...
I have a bufferedImage which is getting drawn to and then rendered to the screen every frame. The issue is that for some...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Done, #3872. Build will be here: https://d157l7jdn8e5sf.cloudfront.net/dev-textures-critical/pixi.js
Timeline from my point of view:
https://www.twitch.tv/videos/130864061 05:28:00 - filling the issue 06:10:00 - submitting the issue 06:30:00 - I’m making alternative PR 06:41:00 - you can see our chat and then we started a talk about a filters “hackerham : OH GOD FILTERS !#@$%” - thats me 06:44:40 - the filter issue