In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "PHP garbage collection and memory management related content", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "PHP garbage collection and memory management related content" bar!
Guidelines for PHP garbage Collection and memory Management
This article will talk about garbage collection and memory management in the development of PHP.
Reference count
In PHP 5.2 and previous versions, PHP garbage collection used the reference counting algorithm.
Basic knowledge of reference counting
Basic knowledge of reference counting
The variables for php are stored in the "zval" variable container (data structure), and the "zval" attribute contains the following information:
The data type of the current variable
The value of the current variable
Is_ref Boolean type identification used to identify whether a variable is passed by a reference
The refcount identifier that points to the number of variables in the "zval" variable container (that is, the number of times this zval is referenced, note that the reference here does not refer to the reference passing value, note the distinction).
When a variable is assigned, a corresponding "zavl" variable container is generated.
View variable zval container information
To view the "zval" container information of a variable (that is, to view the is_ref and refcount of a variable), you can use the xdebug_debug_zval () function of the XDebug debugger.
Assuming that we have successfully installed the XDebug tool, we are ready to debug the variables.
View the zval information of ordinary variables
If our PHP statement simply assigns a variable, the is_ref identification value is 0 and the refcount value is 1; if this variable is assigned to another variable as a value, the refcount count of the zval variable container is increased; similarly, when the variable is destroyed (unset), the corresponding "refcount" minus 1.
Take a look at the following example:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.