I am getting the user details from database using the following code
Here I am creating the object of UserInfoBean inside the while loop, so that I can set the UserName for every user record coming from database. Actually I have 10589 users in database. So since the bean is getting instantiated inside the loop, does 10589 objects be created on the Heap?
If it is so, how should i garbage collect and relieve these objects from the heap for better performance.
Generally speaking, the local objects are garbage collected efficiently by modern days JVM. So there is no point of concern here. But in your case , the local object is being reference again by List object, so there is no point to garbage collect it ? isnt it ?