Community
Participate
Working Groups
JavaModelCache assumes that the underlying VM has a finite heap. Many free VMs (kaffe,gcj) offer the possibility to unlimit the heap. In that case maxMemory() returns Long.MAX_VALUE. The initialization of the hashtable then overflow irremediably the memory. I suggest to put put some limit to the ratio or at least limit it to some value extracted from the current state of the heap if the maxMemory() returns Long.MAX_VALUE. A quick fix would also be to add "ratio = Math.max(ratio, 2d);"
Fixed JavaModelCache constructor as suggested except for the default ratio which I set to 4d that corresponds to the 256MB that Eclipse defaults to in the "eclipse.ini" file. BTW, don't kaffe and gcj support the -Xmx argument defined in "eclipse.ini" ? Or is this value just ignored by these VMs ?
Backported fix to R3_1_maintenance branch.
There is a -Xmx option. However we (gcj/kaffe) consider that it is an interesting feature for most java applications to allow them an infinite heap. So now this is the default behaviour. If the user wants to limit the heap he is free to do so using the argument.
Verified for 3.1.2 using build M20060109-1200. Verified by comparing the code with previous versions. Would suggest that 64000000 be replaced by 64Mb (but this does not affect this bug).
Verified for 3.1.2 using build M20060109-1200 (maxime)
Verified for 3.2 M4 using build I20051215-1506. (On a source code basis.)