scala/scala — pull request #247 by dragos (2012-02-29 15:33:08+00:00)
Title: Better fix for memory leaks in the presentation compiler (take 2)

The explicit call to `perRunCaches.clearAll()` introduced subtle bugs since maps in `Namer` *are* needed between runs of the presentation compiler. For instance, `classAndNamerOfModule` was cleared when it was still needed, leading to spurious errors in pattern matches (claiming a case class was not a case class).

I added a simple implementation of a `WeakHashMap`, and use it in SpecializedTypes. This fixes the memory leak without the explicit call to `clearAll` in the presentation compiler.

A better implementation could go to the standard library, and I plan to do that, but it requires a bit more effort to properly integrate it in the collection library. I'll prepare another pull request if that's desirable.