• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Loading java "modules"

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello forum.

In mi application i'm using ServiceLoader to load modules(classes from .jar file) with diferents ClassLoaders in order to completely unload them when not needed from the context of the application and from the JVM itself. I know maybe is not a common topic "unload classes from JVM", there are some conditions for that to happen, so i am making the necesary effort. To make sure if all is working like expected im tracing the load and unload of classes with -XX:+TraceClassLoading and -XX:+TraceClassUnloading, the info from this parameters shows me that i can do a complete unload of any module from mi app and from the JVM itself (unload from the JVM happens during a complete GC). All this seems to work fine... but mi question is why the .jar files from where the module classes was loaded are keep open by the JVM?, that .jars cant be removed but the JVM says to have unloaded the classes from them. Obiusly this is during JVM execution, but why keep open that .jar files if the JVM has no class loaded from them?, there is any thing i can do to force the JVM to free that .jar files?.

Thanks in advance, and sorry bad english.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Paolo, welcome to the Ranch.

You're asking quite a specific question about an advanced topic, and I don't have a direct answer for you. I think the question is hard to answer, because it depends on the implementation details of the JVM. One place you could start looking is at the source code of OpenJDK (Oracle's Java 6 and Java 7 are almost equal to OpenJDK). But I think it will not be an easy task to find this out from the source code...
 
Paolo Lemos
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jesper de Jong wrote:Hello Paolo, welcome to the Ranch.

You're asking quite a specific question about an advanced topic, and I don't have a direct answer for you. I think the question is hard to answer, because it depends on the implementation details of the JVM. One place you could start looking is at the source code of OpenJDK (Oracle's Java 6 and Java 7 are almost equal to OpenJDK). But I think it will not be an easy task to find this out from the source code...



Glad to hear something from somebody. Thanks!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic