posts - 119, comments - 62, trackbacks - 0, articles - 0

          使用struts2時注意內存泄漏

          Posted on 2008-12-11 12:44 Kevin Meng 閱讀(780) 評論(0)  編輯  收藏
          以前的項目用的是struts1,運行得好好的,現在改用struts2后,發現運行不到一天tomcat就出現內存溢出的錯誤。使用jProfiler分析一下,發現tomcat啟動后使用的內存就一路飆升,而且放在action里面的類根本沒有釋放掉,應該是struts出現了問題,查一下struts的配置,原來沒有配ActionContextCleanUp,在web.xml中加入
          <filter>
            <filter-name>struts-cleanup</filter-name>
            <filter-class>
             org.apache.struts2.dispatcher.ActionContextCleanUp
            </filter-class>
           </filter>
           <filter-mapping>
            <filter-name>struts-cleanup</filter-name>
            <url-pattern>/*</url-pattern>
           </filter-mapping>
          再次用jprofiler進行分析,果然好了。

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 仪陇县| 新巴尔虎左旗| 铜鼓县| 塘沽区| 凤庆县| 大丰市| 麻阳| 元阳县| 福州市| 饶阳县| 莲花县| 民乐县| 仁布县| 吴川市| 大邑县| 安丘市| 普兰县| 辽中县| 平远县| 平定县| 阳山县| 武夷山市| 和政县| 长泰县| 平远县| 织金县| 贺兰县| 绥中县| 怀远县| 北海市| 苍梧县| 内黄县| 临沭县| 娄底市| 慈溪市| 湾仔区| 色达县| 禹城市| 南通市| 申扎县| 资兴市|