aspose file tools
The moose likes JDBC and Relational Databases and the fly likes Relieve database bean objects from heap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of RabbitMQ in Depth this week in the Open Source forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Relieve database bean objects from heap" Watch "Relieve database bean objects from heap" New topic
Author

Relieve database bean objects from heap

Skanda Raman
Ranch Hand

Joined: Mar 21, 2008
Posts: 205

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.

Please let me know.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874




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 ?
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32016
    
200

Eshwar,
What are you doing with a list of 10 thousand usernames? The answer to that will help with performance/memory. It is hard to give advice out of context.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Skanda Raman
Ranch Hand

Joined: Mar 21, 2008
Posts: 205


The idea of adding data to list is that i can set this as an attribute and get the same in JSP to display records.

Please let me know if doing this way is correct. Will this have any performance/memory problem
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Relieve database bean objects from heap