0

How can I determine the source of excessive garbage collection in my HTML5 game?

Here's the result of a heap snapshot I took in chrome: heap snapshot

shino
  • 4,562
  • 5
  • 38
  • 57
  • Example, please? How can we answer if you don't tell us anything that's going on? – bfavaretto Sep 05 '12 at 02:59
  • http://stackoverflow.com/questions/864516/what-is-javascript-garbage-collection Perhaps a relevant question you may look into? Having a good understanding of what garbage collection helps. – aug Sep 05 '12 at 03:00
  • What do you mean by "excessive"? Too-frequent collection? Could you describe some symptoms to explain why you think your issue is related to garbage collection at all? – nnnnnn Sep 05 '12 at 03:34
  • @nnnnnn: Sure -- looking at the memory timeline in Chrome shows the characteristic zigzag pattern of heavy garbage collection. Eventually, the garbage collection starts taking on the order of a second to complete, resulting in an unacceptable pause. Qiao essentially answered my question (hence the screenshot I posted), though I am hoping for more insight into the problem. For example, how can I get to the bottom of where all the Array objects are coming from? Is there some way to find out where they were created? – shino Sep 05 '12 at 03:51

1 Answers1

1

Chrome developer tools support the heap profiling. You may refer to https://developers.google.com/chrome-developer-tools/docs/heap-profiling

qiao
  • 17,941
  • 6
  • 57
  • 46