Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Handling very large arrays in java

800343May 26 2008 — edited May 27 2008
Hi

I'm developing an application which needs an int array of size 100,000,000 ( ie. int[] arr = new int[100000000];)
Now When I run this line of code on my pc I get a java heap memory error. The largest array I can make is 15,000,000 units.
I have 1Gb of memory on my system and I have set -Xms512m -Xmx1024m in my Eclipse settings.

What I don't understand is that when I run this same code in Visual Studio and C# it runs fine (I only get a memory error at 300,000,000 )

I'm pretty sure that c# doesn't manage memory that much better than Java, what could be causing this?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 24 2008
Added on May 26 2008
13 comments
898 views