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

          使用struts2時注意內存泄漏

          Posted on 2008-12-11 12:44 Kevin Meng 閱讀(782) 評論(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進行分析,果然好了。

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


          網站導航:
           
          主站蜘蛛池模板: 缙云县| 巴青县| 开鲁县| 泸定县| 政和县| 阿鲁科尔沁旗| 股票| 牡丹江市| 蓝山县| 昌都县| 昌吉市| 霍州市| 涟水县| 平凉市| 武汉市| 乳源| 土默特右旗| 当阳市| 茶陵县| 宁陕县| 若尔盖县| 剑川县| 奉新县| 霍州市| 大姚县| 新郑市| 南开区| 武鸣县| 霞浦县| 墨玉县| 定南县| 湟中县| 博兴县| 青海省| 乐平市| 竹溪县| 建水县| 禄劝| 海伦市| 平邑县| 阆中市|