malloc without free, what happens?

Source: Internet
Author: User

It ' s per-process. Once your process exits, the allocated memory is returned to the OS for use by other processes (new or existing).

To answer your edited question, there's only a finite amount of memory in your machine. So if you had a memory leak, then the major problem was that the memory isn ' t available for other processes to us E. A secondary, but not negligible, effect are that your process image grows, you'll swap to disc and performance would be H It. Finally your program would exhaust all the memory in the system and fail, since it's unable to allocate any memory for Itse Lf.

It's arguable that for a small process with a short lifetime, memory leaks is tolerable, since the leaked memory would be Small in quantity and short-lived.

Take a look at this resource, for possibly more info than you ll ever need. What do we ' re discussing here is dynamic or heap allocation.

malloc without free, what happens?

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.