TAMING THE CHROME DEV TOOLS

Why Chrome?

Very large user base

Intuitive Controls

Nice, clean and minimalistic design

Very light weight

Very handy tool set

Why debugging?

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. ” - Brian Kernighan

 

Brain worked alongside Unix creators Ken Thompson and Dennis Ritchie and contributed to the development of Unix.

Why talk about it? I know how to use the dev tools

Are you sure?

Sanity check !

Do you know what Chrome Canary is ?

Playground for developers to explore the latest features in Chrome before they land in the stable channel

My aim with this talk ...

Take you debugging skills to the next step 

Javascript Memory management 101

ripped off from  "A trip down to memory lane" - Google IO

core Concepts

  • What type of values are there?
  • How are the values organized?
  • What is Garbage?
  • What is a Memory Leak?

Values 

  • Booleans
  • Number
  • String 
  • Objects
  • External Objects (DOM, image data)

 

 

No arrays?

How are they organized in memory?

Retaining Path

Retaining path # 1

Retaining path # 2

Retaining Path to the Yellow Node

Remove Nodes

Garbage

Garbage nodes

Garbage Collection

Retained Size

What is a Leak?

Usually occurs when you have mistakenly left a retaining path preventing the object to be GC-ed

//... javascript

//some object
user.details = document.createElement('div');

//some display list
usersList.appendChild(user.details);

Lets visualize this through the memory graph ...

user

usersList

details

div

child div

child div

Javascript Objects

External Objects

Leaking Node

Remove the display list

//... javascript

usersList.removeAllChildren();

user

usersList

details

div

child div

child div

Javascript Objects

External Objects

Leaking Node

<-- Leaked Node

Lets use the Dev Tools for a small example on how to figure out if there is a leak in my application...

ProTip:

Use named functions, they ease debugging

 

Enter mobile debugging

chrome://inspect/devices

Mandatory mention of lala !

Thanks ...

http://about.me/mukhan

https://github.com/mohuk/chromeDevToolsDemos

Demo Source

Taming the Chrome Dev Tools

By Mohammad Umair Khan

Taming the Chrome Dev Tools

This talk aims at displaying the power of Developer Tools of the Google's famous browser Chrome.

  • 1,189