Home > Web Front-end > JS Tutorial > body text

stack memory in javascript

不言
Release: 2018-07-05 17:28:47
Original
1414 people have browsed it

<--------Stack memory--------->

Commonly known as scope (global scope/private scope)

 >Execution environment provided for js code (where js code is executed)

 >Basic data introspection is stored directly in stack memory

<----- ---Heap memory--------->

Stores reference type values ​​(equivalent to a storage warehouse)

 >Objects store key-value pairs

 >The function stores the code string

In the project, the less memory we have, the better the performance. We need to get rid of some useless memory

[Heap Memory】

 var o = {}; The heap memory corresponding to the current object is occupied by variable o, and the heap memory cannot be destroyed

 o = null; null is called a null object pointer (not Point to any heap memory), at this time the last heap memory is not occupied. Google Chrome will automatically release (destroy/recycle) the unoccupied heap memory during idle time. IE browser uses counting pointer method

【Stack Memory】

Under normal circumstances, function execution forms stack memory. After the function is executed, the browser will automatically release the formed stack memory; sometimes after execution is completed, the stack memory cannot be released.

The global scope is executed when the page is loaded and destroyed when the page is closed;

The above is the entire content of this article. I hope it will be helpful to everyone's learning. For more related content, please Follow PHP Chinese website!

Related recommendations:

js execution context variables, functions, this

Convert URL to JSON format

The above is the detailed content of stack memory in javascript. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!