Python object and memory relationships

Source: Internet
Author: User

First you enter a string, the string is size, the computer puts it in memory, automatically give it a starting pointer to the first position of the string, and then you assign the string to a variable, the object in memory to open up a space, This variable automatically joins the pointer to the starting position of the string, and then you assign the variable to the variable 2, and the memory opens up a space to hold the variable 2. Then, this variable 2 the connection variable 1 of the pointer to the beginning of the string to take away, the variable 1 there is no pointer to connect, if it is a long time is a loner, it loses its role, lost its role, will be in Python garbage cleanup station to be recycled.

If you don't want your variable 1 to lose its effect, give him a string, and he has a pointer to it, and he has a job to avoid being cleaned by garbage back to the station.

Python object and memory relationships

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: 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.