Reputation: 30430
I have this complex front end web application that I'm trying to optimize with a lot of data flowing through. Now I see about 40% of time is spent in garbage collection using chrome profiler. Is there any way to see which part of the code causes the allocations which will take garbage collection time the most?
Note that this question is not specific to google chrome. I don't mind using another tool to find out.
Upvotes: 1
Views: 345
Reputation: 32296
Your code is most probably instantiating lots of short-lived objects (DOM nodes?). The time spent in the GC does not generally depend on the type of objects being collected, mostly on the number of those.
So, you might try taking and comparing two heap snapshots to see what type of objects is prevailing in the list of new allocations. More details can be found at https://developers.google.com/chrome-developer-tools/docs/heap-profiling#views_comparison (the only difference is that you should take the first snapshot just after a [forced] GC has completed, and the second one when a considerable amount of heap has been allocated.)
Upvotes: 2