[hibernate-dev] Memory consumption

Markus Heiden markus at markusheiden.de
Fri Nov 9 15:21:53 EST 2007


After executing actions, the actions (e.g. EntityInsertAction) will be moved 
from ActionQueue.inserts etc. to ActionQueue.executions to stay there until 
the transaction completes. Because they do have a reference to the instance 
being saved, they prevent that instance from being  garbage collected. Isn't 
it possible to clear the instance field after execution? For example the 
EntityInsertAction needs the entity just for getting the id. Can't the id be 
retrieved direcly after execution?

I ask, because I tried to insert many new objects to the database and tried 
with Session.flush() and Session.evict() to get rid of these objects each 
1000 objects, because the memory usage was too high. But for the above 
reason I had no chance to succeed. The workaround was to commit the session 
more often, but this breaks transactional behaviour.

Any thoughts?

Markus Heiden





More information about the hibernate-dev mailing list