JS Management Memory

Source: Internet
Author: User

When data is no longer useful, it is best to release its reference by placing its value null-this is called dereferencing (dereference). This applies to global political reforms and properties of global objects.

function Createperson (name) {     var Localperson = new Object ();     Localperson.name = name;     return Localperson;        } var Globalperson = Createperson ("Nicolas");//manual Unbind Globalperson = null;

Localperson has left its execution environment after the execution is complete. But for global variables, we need to manually dereference them when we're not using them. Releasing a reference to a value does not mean that the memory occupied by the value is automatically reclaimed, and the true purpose of dereferencing is to leave the value out of the execution environment so that it can be reclaimed the next time the garbage collector runs.

JS Management Memory

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.