如何增加 maven-glassfish-plugin 的内存?
我正在使用嵌入式 Glassfish 的 Maven 插件 - 这是我的插件声明:
<plugin>
<artifactId>maven-glassfish-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.0-alpha-4</version>
<configuration>
<httpPort>8080</httpPort>
</configuration>
</plugin>
在我的数据密集型 Web 应用程序中多次单击后,我用完了 PermGen 空间。
java.lang.OutOfMemoryError:永久代空间
我已经配置了 MAVEN_OPTS 以使用更多内存:
set MAVEN_OPTS=-Xmx1024m
但看起来由 mvn glassfish:run
生成的 Java 进程在它之前只获得了大约半 GB 的内存抓住了。
Glassfish 插件是否有任何用于增加内存的配置设置?
谢谢!
I'm using the Maven plugin for embedded Glassfish - here's my plugin declaration:
<plugin>
<artifactId>maven-glassfish-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.0-alpha-4</version>
<configuration>
<httpPort>8080</httpPort>
</configuration>
</plugin>
After several clicks through my data-intensive web app, I run out of PermGen space.
java.lang.OutOfMemoryError: PermGen space
I've already configured MAVEN_OPTS to use more memory:
set MAVEN_OPTS=-Xmx1024m
But it looks like the Java process spawned by mvn glassfish:run
is only getting about half a gigabyte of memory before it seizes up.
Does the Glassfish plugin have any configuration settings for upping its memory?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只是为了澄清。永久代空间包含加载的类对象和内部字符串。它被分配在 Java 堆的外部,如下所示:
在最新的 Sun VM 上,默认最大大小为
64m
(即-XX:MaxPermSize=64m
),对于大多数人来说已经足够了应用程序(问题很可能与这里频繁的取消部署/重新部署有关)。无论如何,我会尝试使用-XX:MaxPermSize=128m
或-XX:MaxPermSize=256m
,1024m
看起来真的太大了!Just to clarify. The permanent generation space contains loaded class objects and interned strings. It is allocated outside of the Java heap as illustrated below:
On recent Sun VMs, the default maximum size is
64m
(i.e.-XX:MaxPermSize=64m
) and is adequate for most applications (the problem is very likely related to frequent undeploy/redeploy here though). I would anyway try with-XX:MaxPermSize=128m
or-XX:MaxPermSize=256m
,1024m
seems really oversized!经过进一步咨询一些同事后,看来我在 Maven 中增加了错误的内存值。
为了增加 PermGen 空间,我将其添加到我的 MAVEN_OPTS 中:
After further consultation with some colleagues, it seems I was increasing the wrong memory value in Maven.
To increase PermGen space, I added this to my MAVEN_OPTS: