PHP can also detect and obtain the memory information of Windows, and the code is quite simple. I discovered it accidentally and thought it could be used in the future, so I would like to share it with you.
This code will get the total memory, initial usage and other memory information:
01
02echo "Initial: ".memory_get_usage()." Byte n";
03for ($i = 0; $i < 100000; $i++) {
04 $array []= md5($i);
05}
06for ($i = 0; $i < 100000; $i++) {
07 unset($array[$i]);
08}
09echo "Final: ".memory_get_usage()." Byte n";
10echo "Total memory: ".memory_get_peak_usage()." Bytes n";
11?>
Example of running results:
Initial: 66104 bytes Final: 590600 bytes Total memory: 12591704 bytes