zoukankan      html  css  js  c++  java
  • kill -QUIT <pid>

    On Solaris and Linux a thread dump is also printed if the J2SE process receives a QUIT signal. So kill
    -QUIT <pid> causes the process with id <pid> to print a thread dump to its standard output.
    or

    kill -3 <pid>

    java问题定位和诊断
    post-mortem事后剖析,验尸

    hs_err_<pid>.log致命错误日志
    -XX:OnError指定崩溃时执行的脚本,这是可以强制做dump
    -XX:+ShowMessageBoxOnError让进程停下来,启动gdb等
    jinfo获得配置信息
    jmap共享对象列表,-heep,-histo,-permstat

    死锁或挂起
    jstack
    jdb

    性能和资源消耗
    jconsole
    jstat

    HPROF Profiler动态库jvm ti接口
    jhat

    -XX:+HeapDumpOnOutOfMemoryError工作目录下输出文件java_pid<pid>.hprof
    -XX:HeapDumpPath=
    -XX:+HeapDumpOnCtrlBreak
    -XX:+PrintClassHistogram
    -Xcheck:jni

     -verbose:gc可以用管理api或jvmti动态使能
    -XX:+PrintGCDetails
    -XX:+PrintGCTimeStamps

    -verbose:class为类加载或卸载写日志
    -verbose:jni

    java -agentlib:hprof=heap=sites ToBeProfiledClass
    java -agentlib:hprof=help
    javac -J-agentlib:hprof=heap=sites Hello.java
    java -agentlib:hprof=file=dump.hprof,format=b <Application>java5update7以后都不需要这样自麻烦了,用选项-XX:+HeapDumpOnCtrlBreak;如果不能在命令行指定,可以用环境变量指定:
    JAVA_TOOL_OPTIONS
    java.security.debug System Property

     ltrace动态库调用
    mtrace内存分配
    strace系统调用

    Exception in thread “main” java.lang.OutOfMemoryError: Java heap space

    配置太少内存导致堆的某个部分不够分配,也可能是交换空间不够大导致系统的内存用尽,并不一定是内存泄露。有finalizer方法的对象在gc后被放在一个队列,有个专门线程会回收它,但是如果产生对象的线程高优先级,导致产生的速度大于回收速度也可能导致ooe。

    Exception in thread “main” java.lang.OutOfMemoryError: PermGen space

    -XX:MaxPermSize

    String.intern()也会用掉永久代空间

    Exception in thread “main” java.lang.OutOfMemoryError: Requested array size exceeds VM limit

    Exception in thread “main” java.lang.OutOfMemoryError: request <size> bytes for <reason>. Out of swap space?
    Exception in thread "main" java.lang.OutOfMemoryError: <reason>
            <stack trace>(Native method)
    A crash instead of an OutOfMemoryError这是因为本地方法分配内存失败并且没检查返回值
    -Xshare:off 关闭类数据共享

     -Xrs

  • 相关阅读:
    vue之前端鉴权
    vue jsx与render的区别及基本使用
    vue-svgicon基本使用
    vue-cli 3.0按需引入element-ui
    手动实现Promise
    checkbox、radio设置自定义样式
    AngularJS之拖拽排序(ngDraggable.js)
    webpack 4.x之搭建前端开发环境
    VUE,基于vue-cli搭建创建vue项目
    ES6面向对象 动态添加标签页
  • 原文地址:https://www.cnblogs.com/jvava/p/3517402.html
Copyright © 2011-2022 走看看