Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
Preventing Memory Leak when using HashMap
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="markspace, post: 4025621"] If the HashMap becomes unreachable, it will be garbage collected. A HashMap only "leaks" when you have a reference to the HashMap you want to keep, and you want to remove a reference inside the hash map. In fact, I believe this problem only really occurs when you have a WeakHashMap, which can accidentally hold on to it's own references. If you are using a local variable, then you are fine. The hash map will be eligible for garbage collection as soon as the local variable goes out of scope. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
Preventing Memory Leak when using HashMap
Top