Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EclipseLink memory leak?(The longer our server is running, the more memory is used by EclipseLink.)
EclipseLink memory leak? [message #1289258] Wed, 09 April 2014 07:05 Go to next message
Jens Huettemann is currently offline Jens Huettemann
Messages: 2
Registered: April 2014
Junior Member
We seem to have a memory leak in our EclipseLink installation on the server . We use EclipseLink 2.2.
In our application, each user who logs on gets an own EntityManager assigned that is assigned exlusive the user session. It is kept for the duration of user session.
Each EntityManager has a connection pool, with exactly one database connection.

The longer our server is running, the more memory is used by EclipseLink.
For example with each logon about 600 bytes more memory is need by EclipseLink, because it keeps an additional ConnectionPolicy object for each logon.

In addition, a SessionEventAdapter is registered on the EventManager for each EntityManager generated . When the user session ends, the SessionEventAdapter is removed from the EventManager.
But the SessionEventAdapter does not seam to be released, so they cannot be removed by the GC.
The SessionEventAdapter objects still are available, the SessionEventAdapter are included in the listener list of the SessionEventManager .
I could determine this with a profiler .

Is there a mechanism by which I can free EclipseLink unnecessary objects I described above?
Can EclipseLink be "resetted" in order to clear the memory controlled by a timer?

For a tip, I would be very grateful.
Re: EclipseLink memory leak? [message #1290917 is a reply to message #1289258] Thu, 10 April 2014 14:57 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1021
Registered: July 2009
Senior Member
EntityManager instances are not meant to be kept around indefinitely, and instead treated much like transactions. As such, entity instance read in through an EntityManager are kept cached for the life of the EntityManager - they must remain managed. I hope that you have accounted for this, and that the memory issues you are encountering are due to the connections and SessionEventAdapter as mentioned, though I do not quite understand why there would be a leak. Everything associated to an EntityManager should be garbage collected when the EntityManager is, so I am curious as to why, when the session ends, the EntityManager isn't being collected by the GC.
Re: EclipseLink memory leak? [message #1291665 is a reply to message #1290917] Fri, 11 April 2014 05:48 Go to previous message
Jens Huettemann is currently offline Jens Huettemann
Messages: 2
Registered: April 2014
Junior Member
I checked it again. After ending the user session, the EntityManager is closed - and it seems to be garbage collected. In a snapshot done after closing EntityManager and forcing a GC there is no EntityManger left, but the SessionEventAdapter is still referenced by the listeners list of the SessionEventManager.
Previous Topic:Issue with orphanRemoval = true and OptimisticLockException
Next Topic:@XmlInverseReference generate wrong JSON for bidirectional relations
Goto Forum:
  


Current Time: Thu Sep 18 18:04:01 GMT 2014

Powered by FUDForum. Page generated in 0.05504 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software