java static hashmap memory problem
<p>I have 2 classes, let's call the class A and class B.</p>

<pre><code>public class A{
private static HashMap&lt;String,B&gt; isc= new HashMap&lt;String,B&gt;();

public static void UserDisconnected(String key){
    if(isc.containsKey(key)){
     if(isc.get(publicSID).timer != null){
      isc.get(key).timer.cancel();
      isc.get(key).timer=null;
     }
     isc.remove(key);
    }
    log.debug("isc size:" + isc.size());
}

//and other non-static variables and methods

}

public class B{
//contain no static variables and methods
public void startStream(){
    timer = new Timer();
    timer.schedule(new timedTask(), 0, interval);
}

public class timedTask extends TimerTask{
    public void run(){
        //do something
    }
}
</code></pre>

<p>Class A will live through the entire lifetime of the application while the instances of class B that is referenced in the hashmap(isc) that is in Class A.
The problem is, after i run UserDisconnected() method in class A, i see that the size of isc is 0, but the memory usage as shown in the task manager of windows server 2008 down go back down, don't see any memory being freed.
So, i wonder, were the instances of class B in the hashmap garbage collected? or are they lost somewhere where the garbage collector couldn't even collect it.</p>

<p>Thanks.</p>
