[Mono-list] mcs compiles on linux. Now what?
Serge
serge@wildwestsoftware.com
Fri, 8 Mar 2002 14:36:34 +0200
I forgot to post this to the list last night.
There is a small bug in Hashtable that has some major consequences.
In some cases it allocates much more memory than expected, for example
resizing to 1115 will allocate 240101 slots, supposed to be 1237.
In other cases it allocates significantly less memory,
resizing to 400000 will allocate 400009, expected 540217.
Surely has some influence on memory usage ;-)
The fix is below.
Sergey
Index: Hashtable.cs
===================================================================
RCS file: /cvs/public/mcs/class/corlib/System.Collections/Hashtable.cs,v
retrieving revision 1.10
diff -u -r1.10 Hashtable.cs
--- Hashtable.cs 2002/02/07 17:33:38 1.10
+++ Hashtable.cs 2002/03/07 18:20:12
@@ -676,7 +676,7 @@
private static int ToPrime (int x)
{
- for (int i = x/ALLOC_GRAIN; i < primeTbl.Length; i++) {
+ for (int i = 0; i < primeTbl.Length; i++) {
if (x <= primeTbl [i])
return primeTbl [i];
}