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

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


Back to the top