amccreight / heapgraph

Analysis of Firefox cycle collector and garbage collector heap graphs
24 stars 16 forks source link

stringy: string length is computed incorrectly for escaped strings #21

Open amccreight opened 10 years ago

amccreight commented 10 years ago

A string in the GC log like 'foo\n' gets recorded as having a length of 5, but the last character is actually '\n', not 'n', so the length should be 4. The main effect of this is that the string count can be wrong, sometimes showing up as 0. What needs to be done here is to figure out how the JS engine is escaping these strings, then unescape them and use that to compute string length.