Home  >  Article  >  Web Front-end  >  stack memory in javascript

stack memory in javascript

不言
不言Original
2018-07-05 17:28:471408browse

<--------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!

Statement:
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