1

I'm developing a web app using Eclipse/Glassfish on Windows 7, and I see this error at least a few times a day when deploying a new version of the app:

SEVERE: Exception while preparing the app : PermGen space
SEVERE: java.lang.OutOfMemoryError: PermGen space

When I see it, I have to close Eclipse, use the Windows Task Manager to stop a Java process (which I suspect is Glassfish), and re-start Eclipse. It's a nuisance, and an unwelcome interruption.

Is there anything I can fix/configure that would make this error go away, or at least decrease its frequency? Or is this a memory leak I'm just going to have to live with?

4

1 回答 1

0

这是 Sun / Oracle JVM <= 7 中的内存泄漏,在使用 JPA 时经常发生。升级到Oracle 的 JVM 8 应该可以解决这个问题

如果您绑定到 JVM 7 或更低版本,您可以在 Eclipse 中将以下 VM 参数添加到 Glassfish 的启动配置中以增加内存限制(在本示例中为 1024 MB),这会降低 OOM 的规律性:

-XX:MaxPermSize=1024M
于 2016-10-26T17:16:36.787 回答