I have a try catch and finally block like this.
Client client = new Client();
try {
...
}
catch {
...
}
finally {
client = null;
}
I would like to ask if client = null is necessary to wipe out memory use for client object if exception occurs.
client = null;) ?java memory null variableon StackOverflow has 4 relevant question in the first 50 results (just skimmed over the titles, didn't take very long) - I suppose other combinations fare well too. I alone have seen this questions dozens of times, and I'm sure I didn't see them all.clientso it might even postpone the garbage collection up to that statement. Does not matter, but if beforefinallythere is some huge allocation.