I am wondering if i new some object but forget to delete it, when the process exit, will the leaked memory be returned to the OS?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This isn’t so mush a C++ question as an operating system question.
All of the operating systems that I have knowledge of will reclaim conventional memory that had been allocated. That’s because the allocation generally comes from a processes private address space which will be reclaimed on exit.
This may not be true for other resources such as shared memory. There are implementations that will not release shared memory segments unless you specifically mark them for deletion before your process exits (and, even then, they don’t get deleted until everyone has detached).