Memory concerned citizen

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sukatoa
    Contributor
    • Nov 2007
    • 539

    Memory concerned citizen

    Good day,

    Is it a good practice to reinitialize an object with null if it is no longer be used or an expected new initialization comes in?

    for example

    Code:
    Objective obj = new Objective();
    while( something_will_false_later ){
           //operations that uses Objectives
    }
    obj=null;
    Later, that snippet will be utilized again...

    Any advise?
  • mrjohn
    New Member
    • May 2009
    • 31

    #2
    If obj is inside a method, won't it be set to null at the method's conclusion anyways? Then the garbage collector will get it.

    Comment

    Working...