• Post Reply Bookmark Topic Watch Topic
  • New Topic

Does memory Leak happens if we use a HashMap?  RSS feed

 
Sat Nar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
kindly let me know if memory leak happens if we store objects in a HashMap.Also let me know other possibilities of memory leaks.

Regards,
Sathya
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It really depends on you, as a developer. Nothing to do with whether using a HashMap will cause memory leaks or not. For example, if you're creating objects now and then, and storing them into a HashMap, and yet not using it at all, clearly, we'll see an increase in memory usage and eventually out of memory may occur. You don't have to use a HashMap to see this, a Vector or ArrayList would work too.

Loitering objects and creating many short-lived objects are two main culprits of memory leaks. Do a Google search & you'd find more information on them.

Cheers!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!