title: static HashMap is causing the memory leak,but how to rectify it?
body: <p><code>private static Map&lt;interface,class&gt; m =new HashMap&lt;interface,class&gt;;</code> </p>
  
  <p>is an instance variable of a class.</p>
  
  <p>In the constructor of <code>class  Synchronized(m){m.put(this,this);}</code>,</p>
  
  <p>The problem is here key and value is same and hence when an updated indication is coming the HAshMap is collecting all the data and it never GC'ed. it is causing leak.</p>
  
  <p>I tried a work around and removed the static keyword and it's working fine.But i think removing static can cause some severe problem.</p>
  
  <p>Is there any other way to rectify this kind of leak. Code refactoring is not possible as it's really complex and i am running out of time. Anyone please guide me. Thanks in Advance</p>