Juozas Baliuka wrote:
> Hi,
> Some map implementations in [Collections] use int field to store map size
> (SUN's implementations has the same problems too)
don't see that as a "problem".
> I am not 64 bit JVM user, but I believe it is always sizeof(int) == 32/8 in
> JAVA.
I don't know what the 32/8 is supposed to mean, but the JVM
specification specifices that an int is always 32 bits (4 bytes) and a
long is always 64 bites (8 bytes). Doesn't matter what platform you are on.
> It is not a problem on 32bit JVM, because it will throw OutOfMemoryErro
> first,
huh?
> but it is possible to have negatyve map size on 64 bit JVM.
it would be possible to have a negative map size an a 32-bit VM too if
the size field overflows... doesn't matter what platform you are on.
> Map documentation says size must be in range : 0 <= size <= Integer.MAX_INT
ok, I believe Collection.size() says the same thing, but I'm too lazy to
check.
> The most trivial solution is to use "long" field to store map size and to
> return
> MIN(size, Integer.MAX_INT); It will be problem for 128 bit JVM in the
> future :)
I still don't see why the platform makes many difference. how does that
matter? And honestly, I don't see this size overflow "problem" as much
of a problem.
michael
--
To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
|