PHP garbage collection

The

variable name is stored in the stack space, and the stack area is first in and then out, so how does it pop up when you actively unset a variable?

Apr.07,2021
The variable in

php is assigned at the end of the execution stack. The execution stack zend_execute_data, is actually a piece of heap memory and a variable length structure. The value of the variable is stored by zval, and the variable name is stored in symbol_table. In unset, there is no stack operation, but the variable name is deleted from the global symbol table (the function is the symbol table of the function execution stack), and the zval that stores its value is set to IS_UNDEF,. The memory of the temporary variable in the function is released at the end of the function execution, and the global variable is released at the end of the whole program execution

Menu