PHP detection Get memory Information _php Tutorial

Source: Internet
Author: User
PHP can also detect access to Windows memory information, and the code is quite simple, no intention to find, think later can be used, here to share with you.

This code will get the total memory, initial use and other memory information:

01

02echo "initial:". Memory_get_usage (). "Byte \ n";

03for ($i = 0; $i < 100000; $i + +) {

$array []= MD5 ($i);

05}

06for ($i = 0; $i < 100000; $i + +) {

Unset ($array [$i]);

08}

09echo "Final:". Memory_get_usage (). "Byte \ n";

10echo "Total Memory:". Memory_get_peak_usage (). "Byte \ n";

11?>

Examples of running results:

Initial: 66104 bytes final: 590600 bytes total Memory: 12591704 bytes

http://www.bkjia.com/PHPjc/755617.html www.bkjia.com true http://www.bkjia.com/PHPjc/755617.html techarticle PHP can also detect access to Windows memory information, and the code is quite simple, no intention to find, think later can be used, here to share with you. This code will get total memory, initial ...

  • Contact Us

    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

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.