Understanding String heap size in Javascript / V8
<p>Does anyone have a good understanding/explanation of how the heap size of strings are determined in Javascript with Chrome(V8)?</p>

<p>Some examples of what I see in a heap dump:</p>

<p>1) Multiple copies of an identical 2 character strings (ie. "dt") with different <code>@</code> object Ids all designated as OneByteStrings. The heapdump says each copy has a shallow &amp; retained size of 32 bytes. It isn't clear how a two byte string has a retained size of 32 and why the strings don't appear to be interned.</p>

<p>2) Long object path string which is 78 characters long. All characters would be a single byte in utf8. It is classified as a InternalizedString. It has a 184 byte retained size. Even with a 2 byte character encoding that would still not account for the remaining 28 bytes. Why are these path strings taking up so much space? I could imagine another 4 bytes (maybe 8) being used for address and another 4 for storing the string length, but that still leaves 16 bytes even with a 2 byte character encoding.</p>