使用struts2时注意内存泄漏
以前的项目用的是struts1,运行得好好的,现在改用struts2后,发现运行不到一天tomcat就出现内存溢出的错误。使用jProfiler分析一下,发现tomcat启动后使用的内存就一路飙升,而且放在action里面的类根本没有释放掉,应该是struts出现了问题,查一下struts的配置,原来没有配ActionContextCleanUp,在web.xml中加入 struts-cleanup org.apache.struts2.dispatcher.ActionContextCleanUp struts-cleanup /* 再次用jprofiler进行分析,果然好了。
http://www.ulequ.com/lengxiaohua/ http://www.ulequ.com/lengxiaohua/16335.html http://www.ulequ.com/lengxiaohua/16334.html http://www.yulet.com/chengrenxiaohua/13374.html http://www.yulet.com/quanwen/13382.html