Oct 9th, 2009, 01:16 PM
Memory Management Question
I have a question regarding Spring and memory management.
I have a controller which has a helper class(Business Logic), which in turn has a DAO.
The DAO returns an ArrayList of POJO's to the helper, which returns it to the Controller, which then passes it to the View.
All these objects are in memory and have references to them. And the ArrayList of POJO's which are a result set from the db can be quite large.
Does this mean that after the view is displayed, all these objects are still in memory? If so, how can I avoid that?
Oct 9th, 2009, 02:46 PM
After the view response has been returned, there will likely be no more references to the pojos or the ArrayList which contained them, so they will be eligible for collection, so you generally should not have to worry.
If your business or infrastructure logic somehow stored references to one of those objects in the list into a static list somewhere, then there would still be a reference to it, which would prevent it from being collected.
Tags for this Thread