tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: pump up memory usage
Date Wed, 19 Aug 2009 20:49:40 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ronald,

On 8/19/2009 5:32 AM, Ronald Klop wrote:
> byte[] b = new byte[10000000000];

Java limits arrays to 2147483648 elements, so the above shouldn't even
compile (and it doesn't for me).

Section 2.15.4 of the JLS says:

"
A component of an array is accessed using an array access expression.
Arrays may be indexed by int values; short, byte, or char values may
also be used as they are subjected to unary numeric promotion (ยง2.6.10)
and become int values.
"

Integer.MAX_VALUE is 2147483647 so the largest array you can allocate
will actually have 2147483647 elements (and not 2147483648).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqMZWQACgkQ9CaO5/Lv0PCIpACggoYXUr4aMq6bg35Irkxto4qd
xcAAn2EgjuBtsRRpdWPH9y1VNl8PLgRw
=f3l7
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message