Description: PHP uses a reference count (reference counting) garbage collection (garbage collection) mechanism, each object contains a reference counter, each time a reference connected to the object, the counter plus 1, When reference leaves the build space or is set to NULL, the counter is reduced by 1. When the reference counter for an object is 0 o'clock, the PHP engine knows that you will no longer need this object to free up the memory space it occupies.
is the & operation a pointer?
Not the,& operation is to establish a reference point, not a pointer, and PHP does not have a pointer concept. A soft link to a file similar to UNIX.
What is the difference between the Unset () operation and the assignment of a null value?
(a) Unset () simply disconnects the reference to the memory it originally pointed to, making the variable itself a null reference that has not been defined, and reducing the reference count in the symbol table within that block by 1, without affecting other variables that point to the memory. So the notice is emitted when a variable of this unset () is called. (unset multiple times for a variable only for the first time)
(b) The assignment of a null operation is quite fierce, it will directly point the variable to the memory in the symbol table of the reference count of 0, the memory is naturally recycled by the engine, as to when the re-use is unknown. may be used to store other information immediately, perhaps no longer used. However, all the variables that point to that memory will no longer be able to manipulate the recovered memory, and any variable that attempts to invoke it will return null.
The PHP engine reclaims this memory only if the reference count in the symbol table in the block is 0 o'clock.
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