To test if my object had a memory leak, I instanced it 10000 times and deleted it 10000 times. After, my program was using about 500kb more. I do not think my object is leaking though.
Thanks
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.
On Linux at least, the C library does not release memory back to the OS just because you call
delete. It puts the memory on a “free list” inside your process. So if you are using a command liketoporcat /proc/XXX/statusto measure the virtual memory use, you will see the size consumed by everything in your process including that free list.The C library only releases memory back to the system when you
freeordeletea “large” object. The definition of “large” is something like 128K bytes.I suspect Windows, Mac, etc. work similarly but I do not know for sure.
So the short answer to your question is “No, not necessarily”.