课程: Linux Performance Tuning

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

What is a memory leak?

What is a memory leak?

- [Instructor] So we call allocated memory that we can no longer access, because there's no pointer to it that we have, leak memory. Some programs are written so that by the time they finish, they have freed up all the memory that they dynamically allocated. Some programs don't do that. Some of the memory leak checking programs, run your program, and at the end they report any dynamically allocated memory that was not freed. That might not really be a leak, but it's something a little more straightforward to do. So it is better if you have the practice in your code to always free memory after you don't need it anymore, so that when the program finishes, if there is any still dynamically allocated memory, then that is a mistake and the tools can help you find that. There's also some tools that expect that the memory will be freed within a certain amount of time, like within two seconds after allocating it, you're going to…

内容