Array Maximum Bounds - OutOfMemoryError

Xavior2K3
Xavior2K3 used Ask the Experts™
on
Hi,

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?

Thanks,
Michael
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2006
Commented:
Increase the heap size
    -Xms<size>        set initial Java heap size
    -Xmx<size>        set maximum Java heap size
java.exe -xmx512m
Top Expert 2006

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

Author

Commented:
Great, thanks =)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial