动态类加载是 permgen 的原因之一?
在不同的网站上,动态类加载被认为是永久生成问题的原因之一。
根据我的理解,动态类加载是在需要时加载类。此外,如果加载类 A 并且它引用另一个类 B,它也会随之加载。这就是动态类加载。 对吗?如果是的话,这是 JVM 的基本内置功能。 我们能做些什么?
或者我的理解是错误的。当我们说动态类加载时,我们指的是自定义类加载器吗?
我与上述相关的最后一个问题是,类由客户加载程序加载一次。因此,当我们在应用服务器上进行热部署时,应用服务器如何加载新版本的类。它在这里使用不同的类加载器吗?
On different sites , Dynamic class loading is given as one of the reason of permgen problem.
As per my understanding , Dynamic class loading is loading the class as and when it is required.Alonwith that if Class A is loaded and it is referring another class B , it will also be loaded along with that. This is Dynamic class loading. Right? If yes, this is essential and inbuilt feature of JVM. What we can do about it?
Or my understanding is wrong here. when we say Dynamic class loading , are we reffering to custom class loaders here?
My last question related to above is, Class is loaded once by customer loader. So when we do hotdeployment on application server, how appserver loads the new version of class. Does it use different class loader here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,动态类加载是指在运行时加载编译时未知的类,例如通过
Class.forName
或反射(1, 2)。No, dynamic class loading refers to loading classes during runtime that are unknown at compile time, e.g., via
Class.forName
, or reflection (1, 2).