In Ajax practice, Section 8.3.1 Describes memory leakage. Examples in the bookCodeIt is much more complicated than the simple sample code in section 4.3.4 of JavaScript advanced programming (version 2nd. The removepet sample code on page 242nd should be:
Person. prototype. removepet = function (petname) {var orphan = This. pets [petname]; this. pets [petname] = NULL; If (orphan. unassignowner) {orphan. unassignowner (this );}}
In this sample code, the local variable is: The line referenced by whiskers of a pet cat instance for Jim:
Jim. addpet (new CAT ("Whiskers ");
The global variable is: The line referenced by Jim's pet dog Fido:
VaR Fido = new dog ("Fido"); Jim. addpet (Fido );
Fido reference occupies valuable memory, which is a memory leakage problem. Until the reference is removed in step 2,Memory can be released later
.
The last sentence in the last row of page 243rd is caused by the uplink. When does this "subsequent" mean? According to JavaScript advancedProgramThe content in Chapter 2nd of design (version 4th) refers to the next GC operation.
In the Ajax practice book, the first step of memory is released. Is the memory released by GC recycled? I still have doubts here, from opening the global variable space to removing the reference, this process can be described as a memory leakage problem in the book. But by the next GC operation, does this process count as a memory leak?
(End)