• Post Reply Bookmark Topic Watch Topic
  • New Topic

Will explicitly making an Object null ,makes any difference in terms of performance or memory  RSS feed

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will these make any difference in performance wise or in terms of Memory Saving .
Assume that i am having a ArrayList with lots of data (1000's of Employee Objects in it )
I am sending this ArrayList to a DAO Layer for DataBase insertion as shown :

// ArrayList created with Objects


After this statement if i add below line will this make any difference ??

All these things are happening under a single method call .

Please let me know , thanks in advance .

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Paul , i assume that all these are within the method call , so all the data with in the method will be explicitly set to null once the method has finished its execution .
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[teacher-mode] You dont "make an Object null" - you set the value of a reference to null. If you use the wrong words when thinking about Java programming you are bound to make errors.[/teacher-mode]

Bill
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William .
 
Sriram Naga
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We need to explicitly null the references to an object if it is in invisible state(when the strong references no longer accessible in the program though existing). How do we identify such scenarios?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!