Yora Posted May 26, 2014 Share Posted May 26, 2014 Hiya, I'm wondering if this type of pattern (memory slowly piling up after each garbage collection then eventually clearing) resembles something like a memory leak or if it's in some way regular behavior. This is in a project with quite a bit going on, but to my knowledge is not actively creating any new objects (at least not with the 'new' keyword). I just want to make sure I'm not worrying over nothing, or if there is a problem that I address it. Thanks for any help in advance. Link to comment Share on other sites More sharing options...
xzereus Posted May 26, 2014 Share Posted May 26, 2014 From my experience (outside of game dev, but with app dev), this is pretty typical unless you use Object Pooling Link to comment Share on other sites More sharing options...
Antagonist Posted May 26, 2014 Share Posted May 26, 2014 Take a look here : https://www.scirra.com/blog/76/how-to-write-low-garbage-real-time-javascript , Ashley writes about garbage collection. Objects can be allocated without using the 'new' keyword , var a = {} , this create garbage to. And what I have noticed also , drawing on canvas with float values also creates garbage. Link to comment Share on other sites More sharing options...
Yora Posted May 26, 2014 Author Share Posted May 26, 2014 From my experience (outside of game dev, but with app dev), this is pretty typical unless you use Object Pooling I'm familiar with object pooling and am utilizing it, however I'll give this page a look since I see the same timeline pattern there, thanks. I don't doubt that I could be missing somewhere that this could be happening by accident, I just wanted to be sure I identified the graph correctly before I continued chasing any potential problems. Take a look here : https://www.scirra.com/blog/76/how-to-write-low-garbage-real-time-javascript , Ashley writes about garbage collection. Objects can be allocated without using the 'new' keyword , var a = {} , this create garbage to. And what I have noticed also , drawing on canvas with float values also creates garbage. Thanks for that tidbit, gives me something more apparent to look out for. Link to comment Share on other sites More sharing options...
CtlAltDel Posted May 26, 2014 Share Posted May 26, 2014 Looks like it is something related to phaser itself. The simplest demo shows the same behaviour in chrome timeline:http://examples.phaser.io/_site/view_full.html?d=basics&f=01+-+load+an+image.js&t=01%20-%20load%20an%20image&jsbin=http://jsbin.com/zagob/1/edit?js,output Link to comment Share on other sites More sharing options...
Yora Posted May 26, 2014 Author Share Posted May 26, 2014 Looks like it is something related to phaser itself. The simplest demo shows the same behaviour in chrome timeline:http://examples.phaser.io/_site/view_full.html?d=basics&f=01+-+load+an+image.js&t=01%20-%20load%20an%20image&jsbin=http://jsbin.com/zagob/1/edit?js,output Thank you, actually relieving for me to see that so I don't continue my wild goose chase. Link to comment Share on other sites More sharing options...
Recommended Posts