Heap Snapshot - Explanation of (string) vs (compiled code)

721 views
Skip to first unread message

Damien Murphy

unread,
May 24, 2016, 2:08:38 AM5/24/16
to Google Chrome Developer Tools


Hi All,

I have been working on performance analysis using the Chrome Dev Tools to do Heap Snapshots among other things.

I noticed that our website has lots of "(string)" objects when I look at the Heap Snapshot, these "(string)" contain Javascript code that was loaded from file.

I also noticed that this same code is inside "(compiled code)"

Can anyone help me understand why my Javascript code is being stored as a string inside "(string)"?

It is taking up 36MB in (string) & 53MB in (compiled code)



Thanks
Damien

heap 2.png

Alexei Filippov

unread,
May 24, 2016, 12:30:52 PM5/24/16
to Google Chrome Developer Tools
Hi,

The compiled code is a binary executable code.
JavaScript source is also retained because eventually V8 needs to recompile it for the sake of performance optimization.

Regards,
Alex

Damien Murphy

unread,
May 24, 2016, 6:37:36 PM5/24/16
to Google Chrome Developer Tools
Hi Alex,

Thanks for the quick reply.

So when looking at memory usage should (string) even be considered since it is required by V8 and nothing can be done about it?

Is there any way to optimize this so it doesn't use up so much memory?

Regards
Damien
Reply all
Reply to author
Forward
0 new messages