java—如何确定终结器队列中对象的创建者

cu6pst1q  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(395)

最近我经常遇到cpu达到100%的情况,所以我检查了一下cpu的情况:



似乎内存已满,所以我转储了heap,并尝试使用mat对其进行分析。
我第一次注意到finalizer的内存非常不正常,占用了2g以上的内存。

相比之下,正常情况下大约是500mb。我最初认为这是因为终结器线程被阻塞了,但是java线程dump:blocked thread without“waiting to lock…”似乎意味着这不是问题的根源

"Finalizer" #3 daemon prio=8 os_prio=0 tid=0x00007f83c008c000 nid=0x1c190 waiting for monitor entry [0x00007f83a1bba000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at java.util.zip.Deflater.deflateBytes(Native Method)
    at java.util.zip.Deflater.deflate(Deflater.java:444)
    - locked <0x00000006d1b327a0> (a java.util.zip.ZStreamRef)
    at java.util.zip.Deflater.deflate(Deflater.java:366)
    at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:251)
    at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:211)
    at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:145)
    - locked <0x00000006d1b32748> (a java.util.zip.GZIPOutputStream)
    at org.apache.coyote.http11.filters.GzipOutputFilter.doWrite(GzipOutputFilter.java:72)
    at org.apache.coyote.http11.Http11OutputBuffer.doWrite(Http11OutputBuffer.java:199)
    at org.apache.coyote.Response.doWrite(Response.java:538)
    at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:328)
    at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:748)
    at org.apache.catalina.connector.OutputBuffer.realWriteChars(OutputBuffer.java:433)
    at org.apache.catalina.connector.OutputBuffer.flushCharBuffer(OutputBuffer.java:753)
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:284)
    at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:261)
    at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118)
    at javax.imageio.stream..close(FileCacheImageOutputStream.java:238)
    at javax.imageio.stream.ImageFileCacheImageOutputStreamInputStreamImpl.finalize(ImageInputStreamImpl.java:874)
    at java.lang.System$2.invokeFinalize(System.java:1270)
    at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:98)
    at java.lang.ref.Finalizer.access$100(Finalizer.java:34)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:210)

一路走下去,我想我找到了占用内存的对象:



所以urljarfile似乎创建了很多未使用的缓冲区,但是我不知道在我到达这里之后如何继续找到问题的根源。也许我需要监视这里的堆栈调用?
add:我想我发现了一些有用的信息,其中大部分都是用jstl-1.2.jar加载的

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题