In Linux, the C language memory is released twice.

Source: Internet
Author: User

In Linux, the biggest headache for C programming is memory management. Especially in memory release, one of the standards is that the memory must be released, otherwise it will cause memory leakage. But pay attention to the release at any time, because the release once is OK, but the same memory is released twice, it is wrong.

Many people understand the truth, but there will be a lot of headaches in actual use. For example, the same memory may be assigned to another pointer during conversion, and the two pointers are released at the end of the result, and the memory operation error is found, it's incredible. So in my opinion, the memory pointer should not be assigned to another pointer. Even if it is assigned, be sure not to assign it to the global variable, this is because it is the most painful thing to query global variables.

I hope that the C language can be changed a little one day, that is, the released memory will be ignored if it is released again, saving the headache of memory problems.

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.