question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory leak in Graphics.clear

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Reactions:28
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
ivanpopelyshevcommented, Mar 24, 2017
1reaction
ivanpopelyshevcommented, Mar 25, 2017

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found