Thursday, January 31, 2013

JS Memory

JS Memory: "Let take a look at what V8 actually does when it runs something like:

function foo(x) {
if (x) {
var hi = "str";
}
return hi;
}
First of all, allocation of string "str" does not happen every time you run this function. It is allocated once by a parser. Every time you execute this code the very same string object will be used again and again. It looks like this:

hidden class
length
hash
str■
"

'via Blog this'