title: In an interview I was asked how do you detect memory leak in Java?
body: <p>I do not know how to answer this question. Instead, I told them that I have not see any practical code/situation in a <strong>Web Application</strong> that could a memory leak. I also told him that if there are too many object being created and these objects going out of scope, the <strong>GC</strong> will take care of reclaiming the memory.</p>
  
  <p>My questions are
  (1) Was my answer good enough ?
  (2) Can you please give me a practical example of the Java Memory leak in a Web and/or non-Web environment?</p>
  
  <p>Thanks</p>