课程: Java Memory Management: Values and References
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Spotting and avoiding memory leaks - Java教程
课程: Java Memory Management: Values and References
Spotting and avoiding memory leaks
- [Instructor] Memory leak is a resource leak caused by incorrect management of the memory allocation and de-allocation. It means that memory gets allocated, but it doesn't get de-allocated when it should be. This leads to more and more and more memory being in use, the application slows down gradually, and eventually runs out of memory, assuming that no more memory can added in the end. You may wonder how does is possible since I've just told you about garbage collection and that it's such a beautiful GPM and process. Well, if you remember correctly, the garbage collector can only free up memory, it doesn't have relation with the stack anymore, so when we are talking about memory leaks, we're talking about objects, having unnecessary relations with the stack. Memory leaks block access to resources, and increase the application usage of memory. This decreases the performance of the application and when there's no memory left, that application will die throwing an out of memory error…