When viewing a process using the Linux command ps or TOP command, you can see the percentage and size of memory consumption, where the size is the same as the Memory_get_peak_usage
The method memory_get_usage refers to the memory that is being used by the current script
Reference http://us2.php.net/manual/en/function.memory-get-peak-usage.php
One is the system allocated memory, the other is the memory currently used by memory, for example:
1, the database read out thousands data, if said to consume 100MB, then the system will be allocated to process 100MB
2, when processing the data after unset off, in fact, the current process of the memory consumption does not become smaller, that is, will not release 100MB space
3, memory is divided into, "used" and "idle", unset will only "used" to "idle", the next memory request will go to "idle" to take
4, the program ends, the GC will release all memory
Unset can let Memory_get_peak_usage do not continue to rise, the program to execute the allocated memory (memory in the process) is still subject to memory_get_peak_usage
More
A) also refer to the title: in-depth discussion of memory management issues in PHP Learn more about PHP memory management
b) PDO Statement->execute () has placed the result set inside.