Bug 464787

Summary: Memory leak by calling JAXBHelperContext - Leak suspect IdentityWeakHashMap
Product: z_Archived Reporter: Igor Repka <igor.repka>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: major    
Priority: P3 CC: martin.grebac, rinaldi.espera
Version: unspecifiedKeywords: performance
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:

Description Igor Repka CLA 2015-04-16 08:21:46 EDT
We have problem with heap memory. In heap dump we can see that 40% of memory is used by org.eclipse.persistence.internal.helper.IdentityWeakHashMap. We call org.eclipse.persistence.sdo.helper.jaxb.JAXBHelperContext (methods wrap and unwrap) from our code. IdentityWeakHashMap is growing in memory all the time till OutOfMemoryException occurrence or server restart.

Our architecture:

We work with SDO objects in our system so we need to use JAXBHelperContext for transformations from / to POJO. Object of JAXBHelperContext is implemented as instance variable in Singleton class - so there is only one instance of JAXBHelperContext in our system. 

We were expecting that GC will be able to delete unneeded instances from IdentityWeakHashMap but according to our performance tests this is not happening. We do not do anything special in persistence logic - just return data or store data - so we do not keep references on objects - we use local scope (objects exists only inside the method).

We tried to change implementation and remove JAXBHelperContext from singleton, after that there was not problem with heap anymore. But it has negative impact on our architecture (performance).  

We use Websphere Application Server v7.
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:30:04 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink