Reputation: 760
We've taken the approach of creating a new EntityManager each time we load an view for editing a record (to support a unit-of-work pattern).
Is there anything special we need to do to allow the EntityManager to be garbage collected? I believe we are releasing all references to the manager but Chrome's "Take Heap Snapshot" tool doesn't show the EntityManager (or any entities) being deleted when we leave our view.
I see that each entity's entityAspect.entityManager
holds a reference to the manager. Does that prevent everything from getting garbage collected?
Upvotes: 3
Views: 791
Reputation: 760
It appears that calling entityManager.clear()
is required to detach all entities from the manager which then allows everything to get garbage collected.
Upvotes: 2