Sealyu

          --- 博客已遷移至: http://www.sealyu.com/blog

            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            618 隨筆 :: 87 文章 :: 225 評(píng)論 :: 0 Trackbacks

          Maybe you know the situation: you are developing a web application using the Maven build system along with an application server like Tomcat or Jetty and a corresponding plugin (e.g. the all famous jetty-maven-plugin).

          One of the coolest features of these containers is the hot-deployment.

          However, every second time a hot deployment is executed, it crashes due to a PermGen space Exception or a similar OutOfMemoryException.

          The cause for this behaviour is a memory leak with the classloaded of these containers. If you are interested in the details, you may read this article on the Classloader Memory Leaks.

          Actually, you can’t fix this bug. But there is a way to prevent it from beeing so painful. And it’s pretty easy: simply assign more memory to your JVM!

          In order to do so, create a new environment variable named MAVEN_OPTS. Maybe you already defined this variable. What you have to do now is to adjust the MaxPermSize (and the other parameters, too) to a proper value according to your machine’s memory.
          For instance, set the MAVEN_OPTS like this:

          -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m

          Having 2 GB of RAM, these values are a good start.

          Now you should be rid of the nasty PermGen space exceptions.



          Related:
          Catching Exceptions with an UncaughtExceptionHandler in Java
          Problems with Assertions in JUnit tests using Eclipse
          .NET Color Constants
          posted on 2010-01-22 11:43 seal 閱讀(496) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): Maven
          主站蜘蛛池模板: 磴口县| 龙里县| 岳西县| 寿光市| 上饶市| 闵行区| 临泉县| 汉阴县| 尚志市| 贺州市| 万盛区| 西藏| 中山市| 海原县| 牡丹江市| 陆良县| 客服| 左权县| 武邑县| 清丰县| 乐昌市| 思南县| 城口县| 岳池县| 固始县| 正阳县| 兴宁市| 南丰县| 宿州市| 鹤岗市| 九龙城区| 错那县| 横山县| 洛阳市| 肃宁县| 武功县| 溧水县| 马公市| 绍兴县| 台北市| 古田县|