Hi,
I changed cacheBundle to be of type WeakHashMap because I think this would fix
the problems mentioned in PR 23952[0].
Apart from that I changed the static type of bundleCache to WeakHashMap to avoid
calling methods via the Map interface because I am under the impression that
most VMs can work more efficiently then.
2005-09-19 Robert Schuster <[EMAIL PROTECTED]>
* java/util/ResourceBundle.java: Changed type of bundleCache
to WeakHashMap.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23952
Index: java/util/ResourceBundle.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/ResourceBundle.java,v
retrieving revision 1.35
diff -u -r1.35 ResourceBundle.java
--- java/util/ResourceBundle.java 13 Sep 2005 22:19:15 -0000 1.35
+++ java/util/ResourceBundle.java 19 Sep 2005 09:12:56 -0000
@@ -105,8 +105,12 @@
/**
* The resource bundle cache.
+ *
+ * <p>Chosing a WeakHashMap here is done deliberately because
+ * this prevents unlimited memory consumption when many bundles
+ * are loaded.</p>
*/
- private static Map bundleCache;
+ private static WeakHashMap bundleCache;
/**
* The last default Locale we saw. If this ever changes then we have to
@@ -375,7 +379,7 @@
Locale defaultLocale = Locale.getDefault();
if (defaultLocale != lastDefaultLocale)
{
- bundleCache = new HashMap();
+ bundleCache = new WeakHashMap();
lastDefaultLocale = defaultLocale;
}
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches