[ 
https://issues.apache.org/jira/browse/CXF-6852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15217931#comment-15217931
 ] 

Lukas Vasek commented on CXF-6852:
----------------------------------

Ok problem is following:

JaxWsDynamicClientFactory.createClient creates new ClassLoader.
But this ClassLoader is never closed.

Simple solution which worked for me should be to add to destroy() method 

ClassLoader cl = Thread.currentThread().getContextClassLoader();
ClassLoader parent = cl.getParent();
Thread.currentThread().setContextClassLoader(parent);
cl = null;

a good solution could be to implement Autocloseable and inside it call 
destroy() to be backward compatible.


 

> Java 8 java.lang.OutOfMemoryException: Metaspace issue while generating 
> dynamic client
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-6852
>                 URL: https://issues.apache.org/jira/browse/CXF-6852
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.7.16, 3.1.6
>         Environment: OSX
> JDK8u77
>            Reporter: Lukas Vasek
>
> Hello, 
> As mentioned in this issue 
> http://stackoverflow.com/questions/36307555/correct-java-8-setup-for-class-unloading-metaspace-cleanup-cxf-issue
>  we are getting OOM exceptions while generating dynamic clients. Problem is 
> that each new generated client creates new URLClassLoader which consumes 
> memory. I don't know if this is bug in CXF or it's more related to JVM setup. 
> I would greatly appreciate any help.
> Thanks



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to