[jboss-user] [JBoss Remoting] - PermGen Space: OutOfMemory caused by loading the same class multiple times

Fabian Epp do-not-reply at jboss.com
Tue Jul 24 06:37:19 EDT 2012


Fabian Epp [https://community.jboss.org/people/fabian.epp] created the discussion

"PermGen Space: OutOfMemory caused by loading the same class multiple times"

To view the discussion, visit: https://community.jboss.org/message/749853#749853

--------------------------------------------------------------
Hello Community,

in our situation we have some server side classes which the osgi-client doesn´t have in it´s classpath. The client knows only its interfaces. The implementations will be loaded from server via Remote Class Loading.

Now the problem is, when we call a server method which returns a certain implementation, the following scenario happens::

1.) On each server call, a new ClassLoader will be created which loads all classes which is needed to create a single instance of the requested type. 
2.) At the next server call, the previous loaded classes are not reused. Instead a new ClassLoader is created which loads and stores the same classes again
3.) If the loaded instances are remembered in a Collection the Garbage Collector has no chance to unload the classes because there is always exactly one existing reference.
--> So, the Perm Gen Space increases and increases till we get an PermGenSpace Out Of Memory Exception

So, my question is:

Is it possible that the same classloader load all classes so that one class is only one time?
How can it be configured?

I´m happy about every solution.

Thank you for your help:

Fabian
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/749853#749853]

Start a new discussion in JBoss Remoting at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2050]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120724/9aadd3fd/attachment.html 


More information about the jboss-user mailing list