Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] EclipseLink and Memory Problems

If your data is being used as read-only, then you could set the read-only
query hint.  This will avoid some of the memory overhead of managing the
objects in the persistence context.

"eclipselink.read-only"="true"



Florian Schaetz-2 wrote:
> 
> Hello,
> 
>> It is very odd if a single UnitOfWorkChangeSet is consuming 227M.  How
>> big is
>> the transaction you are trying to commit?
> 
> The problem occurs while only reading (lots of) data, so there shouldn't 
> be any transaction required and we don't do a commit.
> 
>> Some possible memory issues may be,
>> - You are using a single EntityManager for multiple transactions.  An
>> EntityManager (extended) or persistence context in JPA must tracking
>> everything read through it, so if you re-use the same EntityManager
>> continuously, it will just continue to get bigger and bigger.  You should
>> instead create a new EntityManager per transaction, or call clear() to
>> release its contents.  EclipseLink also provides a weak persistence
>> context
>> option for EntityManagers if you really need to reuse the same one.
> 
> Technically there shouldn't be a transaction. And the problem occurs 
> mainly when throwing the EM away, creating a new one and re-loading the 
> data. As there is only one reference to the old EM (it's wrapped) there 
> shouldn't be any reference left.
> 
>> - Check you cache settings.  If you cache size is very large, or you have
>> Full caching enabled, then the cache will get very big.  Try making a
>> smaller cache, using a weak cache, or disabling the cache by setting
>> share=false.
> 
> Setting the cache to zero did indeed help, but of course I'm not sure if 
> this will not slow down other functions horribly, as it probably 
> increases the amount of queries (which can overload our network).
> 
>> Ensure that nothing in your application is holding onto old
>> EntityManagers
>> or old objects read through old EntityManagers.
> 
> The last could be a problem, as I am not sure if there aren't some 
> objects read through the old EntityManger still hiding.
> 
>> What version of EclipseLink are you using?
> 
> We are using 2.1.1... Thanks for the hints, perhaps it helps...
> 
> Flo
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://old.nabble.com/EclipseLink-and-Memory-Problems-tp29698110p29772843.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top