In retrospect I should not have been surprised - in either case.

Load an applet into Internet Explorer (version 7 in this case). Hit “refresh” on the page from which the applet was loaded. Some classes used by the applet have static initializers. Some of the static initializers start threads. The threads are part of a thread group associated with the first applet instance. On the first reload, all(?) the threads in the first applet’s group are terminated. Second instance of the applet does not start the background threads, since the classes (already) loaded think the background thread exists.

Right. Is this the right behavior? Sometimes. Maybe. My take? Not so much.

Should the state of a re-loaded web page (though applets) share state from the first load? Sometimes this is useful, but this always makes the programmer’s job more complicated. My preference - as with re-loaded server-side web application - would be to share nothing (by default).


On a related but distinct note - ran into a reason for Microsoft to improve the shitty garbage collection in their Javascript interpreter. My daughter provided the use-case. She is very fond of a site called “Horseland”. Her laptop (with 0.5GB memory) was running very slowly. Found Internet Explorer are using 1.3GB of memory. Clearly her favored site was using Javascript, but did not know how to avoid the problem with Javascript in Internet Explorer.

There are a lot of second or third tier web sites that lack the skill to work around the Microsoft Javascript problems. They are going to deploy sites (sometimes quite popular) that - over time - perform very poorly on Internet Explorer, and perform well on Firefox.

I had thought Microsoft was not likely to improve Javascript garbage collection, given that all the first tier sites must write for Internet Explorer. What I had not considered was the effect of the large mass of second and third tier sites. For those sites, there is not the skill to work around Microsoft’s weakness. The net effect is a large number of semi-skilled sites that over time perform better on Firefox than on Internet Explorer.

Yes, there is a good mass-market reason for Microsoft to improve the garbage collection in their implementation of Javascript.