1

I'm loading classes with the standard Java classloader:

ClassLoader loader = new MemoryClassLoader(s.toByteArray());
Class<?> myClass = loader.loadClass(className);

MemoryClassLoader is directly derived from ClassLoader and overrides the findClass()-method:

Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
   return defineClass(name, byteArray, 0, byteArray.length);
}

What I would like to know is if it is needed to unload the loaded class somehow. Is there any unload()-method or something I've to call?

2

1 Answer 1

1

You don't have to unload or unallocate your classes. The Garbage Collector (aka GC) does all the unset stuffs for you.

You can find information about GC here http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.