• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Does memory Leak happens if we use a HashMap?

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
My cellmate was this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic