PHP Process Management Programming Basics (Memory management DIY)

Source: Internet
Author: User

In general, the variables in memory are placed in two places, one is a heap, and the other is a stack. The stack contains both primitive values and variables of the underlying type.

The reference variables such as pointer variables are placed inside the heap. The computer automatically clears the variables inside the stack (because the stack is the memory space allocated by the computer to the process),

And the variables inside the heap are randomly placed, and the computer doesn't know how much memory to erase.

The PHP language will automatically find the memory inside the heap after a program has been executed, and clear the variables (it's cool).

But when you do the process management programming, you open a listening process, always running there, a customer creates a pointer, and then the customer goes, you close the session, but not

Clear this pointer, and PHP doesn't care about the pointer (unless you close the process). In this way, a lot of pointers will be generated, lots of heap variables will be generated, and then your memory will be full.

Then you'll be GG.

PHP Process Management Programming Basics (Memory management DIY)

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.