Announcement Announcement Module
Collapse
No announcement yet.
Memory Management Question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Memory Management Question

    Hi,

    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?

    Thanks.

  • #2
    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.

    Comment

    Working...
    X