Java performs gc by itself, no need to do it manually. Can also set to null. Then there are no references anymore and the object will become eligible for Garbage Collection. GC will automatically remove the object from the heap.