简体   繁体   English

如何估算所需的java permgen大小?

[英]How to estimate java permgen size required?

How can I estimate the permgen space requirement for a java application? 如何估算Java应用程序的permgen空间要求? I am not looking to minimize the permgen space requirement for the code that I write, but given the size of the jars of my own code and that of the 3rd parties, how do I get a reasonable estimate of the permgen size that will be required for running the program? 我并不是想最小化我编写的代码的permgen空间要求,但是考虑到我自己的代码和第三方的jar的大小,我如何才能合理估计所需的permgen大小运行程序?

PermGen space is reserved for long-term objects, those objects who has survived young garbage collections. PermGen空间是为长期对象保留的,这些对象在年轻的垃圾回收中幸免了下来。

It is quite difficult to know how much space do you need. 很难知道您需要多少空间。 I think the best you can do is to use JConsole or VisualVM (or whatever) to profile your applications under several possible scenarios. 我认为您最好的办法是在几种可能的情况下使用JConsole或VisualVM(或任何其他方式)来分析您的应用程序。

This way you can get an idea on how much permgen space do you need, but don't calculate an average, use the maximum. 通过这种方式,您可以了解需要多少磁导空间,但不必计算平均值,而应使用最大值。

Anyway, I won't use the maximum value, instead I will increase it in any percent, at least 15-20%. 无论如何,我不会使用最大值,而是将其以任何百分比(至少15-20%)增加。 But keep in mind, this can be dangerous if you don't estimate over nice scenarios ... 但是请记住,如果您不对好方案进行估算,这可能很危险...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM