您的位置:首页 > 编程语言 > Java开发

Java的内存泄露 Memory leak of Java

2008-10-16 20:18 357 查看
Though GC is the mechanism for memory management for Java, there are some conditions can result in the memory leak.

尽管垃圾收集器负责JAVA内存管理,但是仍然存在一些情况可以导致内存泄露.

 

For example, if there is a collection, there are collection classes in this collection,  there are also collection classes in the second collection classes. If we set the higher lever collection to null, but do not set the inner ones to null values, the GC will not collect the inner classes in time. The longer the system running the memory will be less. What we should do is to set the objects to nulls timely.

 

Another condition is if we invoke a native method, the method may be written in C/C++,  if we allocate some memory but we do not free them, it will result in a memory leak which are not easy to be checked.

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  leak java null system