1

I have a page which I loaded in Chrome with Timeline started, after 5th second, you can see three spikes. After 7th second page is loaded and stabilized. Looks like chrome has allocated memory but didnt garbage collect them.

On nearly 11th second (with a black mark on Image 1), I press Garbage Collect on timeline and I see all memory released down to 3 MB. After memory comes down to 3MB, my page works correctly.

My target is to find memory leaks (if there are any). But after garbage collect, memory comes down and it still runs correctly.

  1. Is there anyway to force garbage collection after page is loaded? So that on mobile devices memory will be freed automatically?
  2. On Image 2, what are these names? They dont look as used within my library (My library's name is WebAtoms), so can I just ignore them?
  3. My library WebAtoms has few objects shown in yellow color, what does that mean (Image 3)?
  4. Is there any tutorial or in depth analysis of how to understand these profiles/timelines and what do they mean?
  5. Is there any straight forward way to get information about memory leak?

Image 1

enter image description here

Image 2

enter image description here

Image 3 enter image description here

Akash Kava
  • 39,066
  • 20
  • 121
  • 167

1 Answers1

0

You have no control on garbage collection in javascript, you can delete properties , or set null values though to hint the GC .

Garbage collection is handled differently from one browser to another since most of them have their own javascript VM. So what might be true with Chrome would not be true on a native mobile browser.

As for how to optimise code ,depends on what the code is.

Wants some tips on how to use all that mess ?

https://developers.google.com/chrome-developer-tools/docs/heap-profiling

mpm
  • 20,148
  • 7
  • 50
  • 55
  • I have read it already, but am not able to understand. Nobody has written what yellow colored items are and what are red colored items. I will go through it once again. – Akash Kava Jul 16 '12 at 12:45