Hi there, I know that I need to use new to instantiate a new object (i.e. NewObject a = new NewObject). But what command do I use to remove or kill an object? I know that Java has the automatic garbage disposal - but I want to remove the object immediately. Thanks for you help!
mrp
Greenhorn
Joined: Aug 12, 2000
Posts: 2
posted
0
I do not think that you can force your object to be reclaimed for garbage collection by the JVM. The only alternative you are having is to inform the JVM that your object is ready to be garbage collected by invoking System.gc(). Hope this info helps. Mathews.
V Srinivasan
Ranch Hand
Joined: Aug 16, 2000
Posts: 99
posted
0
System.gc() method invokation also brings the object to the state of readiness for gc. In run time system takes its own time to do gc. There is one more approach for gc. i.e. a = null; when an object is set to null it is ready for gc. I hope I am in write direction. Please clarify if I am wrong. Thanks and regards