Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java进程存在内存泄漏_Java - Fatal编程技术网

Java进程存在内存泄漏

Java进程存在内存泄漏,java,Java,我有一个Java进程,现在使用1.2GB内存 我使用jmap转储一个heap.bin,使用内存分析器检查,内存只使用了2.4MB 如何查找使用1.2GB内存的对象 细节 大小:2.4 MB类:1.2k对象:57.9k类加载器:66个无法访问的对象直方图 Class Name | Shallow Heap | Retained Heap | Percent

我有一个Java进程,现在使用1.2GB内存 我使用jmap转储一个heap.bin,使用内存分析器检查,内存只使用了2.4MB 如何查找使用1.2GB内存的对象

细节 大小:2.4 MB类:1.2k对象:57.9k类加载器:66个无法访问的对象直方图

Class Name                                                                         | Shallow Heap | Retained Heap | Percentage
class java.io.ObjectStreamClass$Caches @ 0xe1a3f9c0 System Class                   |           16 |       765,096 |     30.94%
sun.misc.Launcher$AppClassLoader @ 0xe55872d0                                      |           72 |       390,664 |     15.80%
org.jdom.Element @ 0xe55a4dc8                                                      |           32 |       343,472 |     13.89%
class com.sun.org.apache.xerces.internal.util.XMLChar @ 0xe18fe228 System Class    |           40 |        65,592 |      2.65%
sun.nio.cs.ext.ExtendedCharsets @ 0xe55acab0                                       |           32 |        64,800 |      2.62%
sun.misc.Launcher$ExtClassLoader @ 0xe55ab718                                      |           72 |        51,792 |      2.09%
sun.text.resources.LocaleElements @ 0xe5552a28                                     |           24 |        50,824 |      2.06%
class java.lang.System @ 0xe155feb0 System Class                                   |           24 |        43,392 |      1.75%
class sun.nio.cs.ext.Big5$Decoder @ 0xe193aab8 System Class                        |           32 |        34,840 |      1.41%
class com.sun.org.apache.xerces.internal.util.EncodingMap @ 0xe1911970 System Class|            8 |        30,496 |      1.23%
sun.text.resources.DateFormatZoneData @ 0xe5552a10                                 |           24 |        25,368 |      1.03%
java.io.PrintStream @ 0xe5592940                                                   |           32 |        25,088 |      1.01%
class java.beans.Introspector @ 0xe1766b10 System Class                            |           64 |        23,424 |      0.95%
class $Proxy1 @ 0xe1b28eb0                                                         |          312 |        23,368 |      0.94%
java.lang.String[560][] @ 0xe55889c0                                               |        2,256 |        20,176 |      0.82%
class sun.security.jca.Providers @ 0xe1a52ed8 System Class                         |           24 |        16,240 |      0.66%
class java.nio.charset.Charset @ 0xe15d5b60 System Class                           |           40 |        12,184 |      0.49%
auo.beol.hisloader.BeolHisLoader @ 0xe55b5848  Thread-4 Thread                     |          160 |        12,064 |      0.49%
auo.beol.hisloader.RecoverHisLoader @ 0xe5651018  Thread-3 Thread                  |          160 |        11,976 |      0.48%
org.jdom.Element @ 0xe55b1520                                                      |           32 |        11,776 |      0.48%
org.apache.log4j.RollingFileAppender @ 0xe55a3350                                  |           72 |        11,512 |      0.47%
org.apache.log4j.RollingFileAppender @ 0xe5587d20                                  |           72 |        11,472 |      0.46%
org.apache.log4j.ConsoleAppender @ 0xe5587e50                                      |           56 |        11,320 |      0.46%
class com.sun.org.apache.xerces.internal.impl.Constants @ 0xe1909fa8 System Class  |          528 |        11,072 |      0.45%
org.apache.log4j.RollingFileAppender @ 0xe55a3590                                  |           72 |        11,000 |      0.44%
org.apache.log4j.RollingFileAppender @ 0xe559b220                                  |           72 |        10,968 |      0.44%
class $Proxy0 @ 0xe1aefcb0                                                         |          160 |        10,672 |      0.43%
auo.cim.util.log.LogThreadData @ 0xe55a44b0                                        |           32 |         8,920 |      0.36%
auo.cim.util.log.LogThreadData @ 0xe5651130                                        |           32 |         8,920 |      0.36%
auo.cim.util.log.LogThreadData @ 0xebf5a038                                        |           32 |         8,920 |      0.36%
Total: 30 of 3,146 entries; 3,116 more                                             |              

您可以尝试使用工具(如

)直观地查看heapdump。必须有一个对象包含引用,它可能导致内存泄漏。如果您有堆转储,您可以看到哪种类型的对象最多,并搜索包含对它们的引用的对象。然后,您应该检查代码,并找到导致内存泄漏问题的行

也许这个链接会有帮助:

还有一个很好的工具,名为MAT:

它帮助我解决了记忆问题