Results 1 to 2 of 2
  1. #1
    javanewbie is offline Member
    Join Date
    Jun 2008
    Location
    Australia
    Posts
    43
    Rep Power
    0

    Default Java heap space?

    int aiNumbers[][] = new int[number] [number];

    what is the maximum number that can be entered here?

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default Suprisingly large.

    Allocation, as you have done it, is a recurrent discussion issue that is better approached by writing a short test stub to do nothing except the allocation and just see what happens.

    I wrote a program recently to test such a thing, ran through five or ten loops before the memory issue slowed things down. Start with 1024 x 64 or something, I would not think a [1024][1024] to be too far from blowout, but we have to realize that the two numerics multiply as a [][]

    Java Code:
    public class HeapHog
    {
        public static void main(String[] args)
        {
            try
            {
                int[][] Flint = new int[1024][1024];//
                Flint = null;
                System.out.println("Suprisingly large");
            }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
        }
    }
    output:
    Java Code:
    Suprisingly large
    If you find a use for a 1024 by 1024 memory space, you will be in the database forum or something. Possibly some games could use this sort of space.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

Similar Threads

  1. java.lang.OutOfMemoryError: Java heap space
    By paul in forum Advanced Java
    Replies: 11
    Last Post: 06-12-2010, 05:30 PM
  2. Java Heap Space
    By sandeeprao.techno in forum Advanced Java
    Replies: 19
    Last Post: 10-30-2008, 11:27 AM
  3. Replies: 14
    Last Post: 06-12-2008, 08:36 AM
  4. Heap Sort in Java
    By Java Tip in forum Algorithms
    Replies: 0
    Last Post: 04-16-2008, 10:27 PM
  5. Java Heap Out of Memory Error
    By stonkers in forum New To Java
    Replies: 3
    Last Post: 07-17-2007, 04:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •