let x = {
'a' = 123
}
let y = {
'a' = 123,
'b' = undefined
}
let z = undefined;
如上,y会比x占用内存多么,z会占用内存么?
我想大声告诉你2017-05-19 10:16:18
undefined occupies memory, has a fixed size, and is stored in the stack area, so z occupies memory. xy objects exist in the heap area, and their memory addresses are stored in stack memory. Because y has more undefined, it occupies more heap memory than x.