Saving PermGen space with several classloaders

We're writing a large GUI app in Scala with a lot of classes, and we've had to increase the PermGen space to be able to load all classes. The app itself shows a series of screen-based activities, each of which loads its own large set of classes. Only one activity is ever loaded/displayed at the any point in time. After going through a couple of activities, we had an `OutOfMemoryError` in the PermGen space. I understand that the PermGen space is [garbage collected just like the rest of the heap](https://stackoverflow.com/questions/3796427/in-java-is-permanent-generation-space-garbage-collected), but I'm interested to see if I can reduce the PermGen space needed by having e.g. one `ClassLoader` per activity so as to allow class unloading. So: 1. I understand that classes loaded by the system ClassLoader cannot be unloaded, as they will forever be referenced by their class loader. Is that true? 1. Provided no more instances of a class loaded by my custom class loader are around, and the class loader can be garbage collected, will its classes be unloaded, freeing PermGen space? 1. Are there any caveats regarding (or common mistakes that would prevent) class unloading?
How big is your PermGen?

以上就是Saving PermGen space with several classloaders的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏