>>"make sure you set your HashTable to null once it is no longer used."
Once you set it to null, this variable will be eligible for Garbage Collection.
Main Topics
Browse All TopicsHi,
I have been facing the problem of OutOfMemoryError. I used Hashtables in the program, but they were never been cleared from the memory. Can somebody teach me how to clear the Hashtables from the memory?
Currently I used Hashtable.put to add an object to the hashtable. I noticed there is a method remove to remove the object. Can I use this? If I use the remove method, will it be cleared from the memory?
Thanks,
rospcc
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
try using WeakHashMap: http://java.sun.com/j2se/1
Business Accounts
Answer for Membership
by: suprapto45Posted on 2006-08-30 at 20:07:19ID: 17425905
>>"I noticed there is a method remove to remove the object"
Nope, this will only remove the object from the HashTable.
Okay, memory is cleared by the Garbage Collector which is present in every JVM. Normally, we should not interfere this.
You can add the memory for JVM of your application and make sure you set your HashTable to null once it is no longer used.