shino
shino

Reputation: 4734

How can I log what is being garbage collected in my javascript code?

I've built an application that wastes 40% of its time collecting garbage, and I'm at my wits' end trying to find out where it is coming from. I've corralled any possible problems in my own code, yet it persists. I'm beginning to suspect some third party code of being the problem, and I'd like to know if I can somehow track down what is being garbage collected. If there's a Chrome-specific answer, that'd be great, but I'll take anything at this point.

Upvotes: 11

Views: 1902

Answers (2)

Oleg Kurbatov
Oleg Kurbatov

Reputation: 1386

In Chrome I would start with following:

  • DevTools > Profile
  • Take Heap Snapshot
  • Working with the application
  • Take Heap Snapshot again
  • Inspect the second snapshot in the comparision mode

Following links may be useful:

Upvotes: 2

Aleš
Aleš

Reputation: 9028

Perhaps you could try Chrome's Heap Profiler?

Also, related questions to Javascript Heap profiling:

Upvotes: 0

Related Questions