• mat工具MemoryAnalyzer进行分析java内存溢出hprof文件


    java服务端程序报错后会生成hprof文件,我们可以通过mat工具MemoryAnalyzer进行分析
    下载地址:

    http://www.eclipse.org/mat/downloads.php


    说明:
    查看HPROF快照
      JProfiler能打开用JVM工具(比如jconsole、 jmap或通过-XX:+HeapDumpOnOutOfMemoryError JVM参数触发)创建的HPROF快照文件

    示例:

    #!/bin/bash
    LANG="zh_CN.UTF-8"
    
    APP_HOME=$(echo `pwd` | sed 's/bin//')
    APPPIDFILE=$APP_HOME/app.pid
    
    case $1 in
    start)
        echo  "Starting server... "
    
        HEAP_MEMORY=512m
        PERM_MEMORY=64m
        JMX_PORT=8888
        JMX_HOST=1.1.1.1
        JAVA_OPTS="-server -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.EPollSelectorProvider -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false "
    
        shift
        ARGS=($*)
        for ((i=0; i<${#ARGS[@]}; i++)); do
            case "${ARGS[$i]}" in
            -D*)    JAVA_OPTS="${JAVA_OPTS} ${ARGS[$i]}" ;;
            -Heap*) HEAP_MEMORY="${ARGS[$i+1]}" ;;
            -Perm*) PERM_MEMORY="${ARGS[$i+1]}" ;;
            -JmxPort*)  JMX_PORT="${ARGS[$i+1]}" ;;
            -JmxHost*)  JMX_HOST = "${ARGS[$i+1]}" ;;
            esac
        done
        JAVA_OPTS="${JAVA_OPTS} -Xms${HEAP_MEMORY} -Xmx${HEAP_MEMORY} -XX:PermSize=${PERM_MEMORY} -XX:MaxPermSize=${PERM_MEMORY} -Dcom.sun.management.jmxremote.port=${JMX_PORT} -Djava.rmi.server.hostname=${JMX_HOST} -Dapp.home=${APP_HOME}"
        echo "start jvm args ${JAVA_OPTS}"
        nohup java -classpath .:./aa-media-2.0.0.jar:$CLASSPATH $JAVA_OPTS com.aaa.media.aaaMediaServer& 
        echo $! > $APPPIDFILE
        echo STARTED
        ;;
    
    stop)
        echo "Stopping server ... "
        if [ ! -f $APPPIDFILE ]
        then
            echo "error: count not find file $APPPIDFILE"
            exit 1
        else
            kill -15 $(cat $APPPIDFILE)
            rm $APPPIDFILE
            echo STOPPED
        fi
        ;;
    
    *)
        echo "Please enter start|stop ... "
        ;;
    
    esac
    
    exit 0
    


  • 相关阅读:
    org.apache.maven.archiver.MavenArchiver.getManifest
    网易云信发送短信验证码
    background-attachment:fixed;
    background-size属性100% cover contain
    width:100% width:auto 区别
    背景图全屏显示
    多行文字的垂直居中
    路径问题../绝对路径/
    用position子绝父相和css3动画,当鼠标一上去元素从底部慢慢向上
    前置后置运算符重载
  • 原文地址:https://www.cnblogs.com/reblue520/p/6239664.html
Copyright © 2020-2023  润新知