Hi Guys,

I am a relative new member in this forum , My name is Javin Paul and I am Java programmer. I have question related to garbage collection in Java

Does garbage collection occurs in PERM Area of Java Heap ?

As per my knowledge PERM area is used to store meta data about classes, methods , variable etc also String Pool created in PERM area of heap so I believe garbage collection does not occur in this place but just wanted to know what do you guys think of it ?

Thanks
Javin

Recommended Answers

All 2 Replies

Does garbage collection occurs in PERM Area of Java Heap ?

AFAIK, yes.

This aspect doesn't come into play a lot when doing regular development and using already existing libraries but becomes apparent when you implement custom classloaders and manage class loading dynamically.

One e.g. would be Tomcat servlet container. Let's assume that Tomcat creates a separate "classloader" for each web application deployed. If out of the many running web apps if one of the web apps is stopped, the corresponding classloader goes out of scope along with the objects/classes created/loaded using that classloader. If now, for some reason a permagen GC is triggered, the classes along with the classloader would now be garbage collected. If you run the JVM with the -verbose:class switch, this can be easily confirmed by the log message "Unloading class somepkg.xxx".

commented: :) I'm looking forward to seeing more great stuff from **your** blog posts. +12

Thanks , you do have a point here that classloader which goes out of the scope will be garbage collected.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.