Out of Memory When Loading Java Entities
Posted
by Hugh Buchanan
on Stack Overflow
See other posts from Stack Overflow
or by Hugh Buchanan
Published on 2010-06-02T21:45:02Z
Indexed on
2010/06/03
1:34 UTC
Read the original article
Hit count: 378
I have a terrible problem that hopefully has a very simple answer. I am running out of memory when I perform a basic
If I have code like this:
MyEntity myEntity;
for (Object id: someIdList) {
myEntity = find(id);
// do something basic with myEntity
}
And the find() method is a standard EntityManager related method:
public MyEntity find(Object id) {
return em.find(mycorp.ejb.entity.MyEntity.class, id);
}
This code worked a couple of weeks ago, and works fine if there are fewer items in the database. The resulting error I am facing is:
java.lang.OutOfMemoryError: GC overhead limit exceeded
The exception is coming from oracle toplink calling some oracle jdbc methods.
The loop exists because an EJBQL such as "select object(o) from MyEntity as o" will overload the application server when there are lots of records.
© Stack Overflow or respective owner