Array Maximum Bounds - OutOfMemoryError

Posted on 2006-10-22
Last Modified: 2011-10-03

I'm trying to create an array with the following:

      int[][] imgArray = new int[3200][4800];

But i get an error:

      Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Why is this and is there any way around it? Are there maximum array bounds?

Question by:Xavior2K3
  • 2
LVL 14

Accepted Solution

hoomanv earned 250 total points
ID: 17783152
Increase the heap size
    -Xms<size>        set initial Java heap size
    -Xmx<size>        set maximum Java heap size
java.exe -xmx512m
LVL 14

Expert Comment

ID: 17783157
Since 3200 * 4800 * 4 (int size) = 58.6 MB

Author Comment

ID: 17797788
Great, thanks =)

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how do i compare an object based on two fields 6 54
couple of eclipse 5 38
Way to decrease size of apk file 9 71
going to wrong jsp page 2 22
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question