In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "the principle of PHP garbage collection mechanism". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the principle of PHP garbage collection mechanism".
Basic knowledge of reference counting
The answer on the official website is that there is a variable container called "zval" for each php variable, which contains not only the type and value of the variable, but also two bytes of additional information that is_ref and refcount is_ref is a Bool value to identify whether the variable belongs to the reference set (reference set).
With this byte, the php engine can distinguish between normal variables and reference variables refcount to represent the number of variables pointing to this zval variable container the reference count in PHP5 in PHP5, zval's memory is allocated separately from the heap (with a few exceptions), PHP needs to know which zval is in use and which needs to be freed. So this requires reference counting: the value of refcount__gc in zval is used to hold the number of times zval itself is referenced, for example, in a b = 12 statement, 12 is referenced by two variables, so its reference count is 2. If the reference count becomes 0, it means that the variable is useless and memory can be freed.
It is as follows:
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.