zoukankan      html  css  js  c++  java
  • 发生java.lang.OutOfMemoryError: Direct buffer memory【转】

    下面是在掉坑了,出现了一次
    java.lang.OutOfMemoryError: Direct buffer memory 错误后的总结。

    发生原因:

    用来 nio ,但是 direct buffer 不够

    解决办法

    1)检查是否直接或间接使用了 nio ,例如手动调用生成 buffer 的方法或者使用了 nio 容器如 netty, jetty, tomcat 等等;

    2)-XX:MaxDirectMemorySize 加大,该参数默认是 64M ,可以根据需求调大试试;

    3)检查 JVM 参数里面有无: -XX:+DisableExplicitGC ,如果有就去掉.

    代码跟踪:

    生成 ByteBuffer 的时候调用了 allication 方法,按下面一步接一步的调用,可以看到 System.gc() :



    而上述参数:-XX:+DisableExplicitGC 会是 System.gc() 失效,因此当某些 nio 的引用到了 old 区又没发生 full gc 的时候,就会出现标题的 memory 异常了。

    非特别说明,均为原创文章,转载请注明: 转载自邓的博客

    其他关于解决该问题的文章链接:

    (1)Virtual Machine 使用堆外内存:http://www.raychase.net/1526

    (2)How to Fix java.lang.OufOfMemoryError: Direct Buffer Memory:http://java67.blogspot.jp/2014/01/how-to-fix-javalangoufofmemoryerror-direct-byte-buffer-java.html

    转自

    (27条消息) 发生java.lang.OutOfMemoryError: Direct buffer memory_Viking的博客-CSDN博客
    https://blog.csdn.net/github_32521685/article/details/50177359

    (27条消息) 内存溢出的几种原因和解决办法_cp_panda_5的博客-CSDN博客_内存溢出的几种原因和解决办法
    https://blog.csdn.net/cp_panda_5/article/details/79613870

  • 相关阅读:

    (luogu)[模板]最长公共子序列
    表达式的值
    邮票面值设计
    尼克的任务
    HISTOGRA
    消防局的设立
    青蛙的约会
    产生数
    奇怪的电梯
  • 原文地址:https://www.cnblogs.com/paul8339/p/15786897.html
Copyright © 2011-2022 走看看