如何测量和减少Jhipster应用程序中的内存使用量?用Heroku引导时

时间:2019-01-17 09:15:43

标签: heroku jvm jhipster

我无法使我的应用程序在Heroku中启动(使用业余爱好计划,Jhipster 5.7),因为如帮助服务所述,我使用了过多的内存:

Your app is crashing because it is using too much memory when it boots:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: Java heap space

You will need to use less than 512MB of RAM both at boot and at runtime. We do 
have this page https://devcenter.heroku.com/articles/java-memory-issues that 
provides some pointers for debugging memory issues.

所以我已经阅读了https://devcenter.heroku.com/articles/java-memory-issues文档,并且有几个问题:

1)有解决此问题的简便方法吗? (如果您是程序员,则对计算机的管理并不感兴趣。)

2)我应该使用哪个程序来检查正在使用的内存:VisualVM?

3)我应该寻找什么以减少内存使用并且不会造成更大的问题?

谢谢

从HEROKU客户服务部编辑:

Java往往会占用更多的内存,但是应该遵循JAVA_OPTS设置。当您仅取消设置JAVA_OPTS并依赖我们的默认值时会发生什么?您可以使用heroku config:unset JAVA_OPTS -a jhipsterpress取消设置。我问,因为通常情况下,在给定可用内存的情况下,我们会自动将JAVA_OPTS设置为应在平台上正确运行的内容。

0 个答案:

没有答案