Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-24-2008, 07:00 PM
Member
 
Join Date: Jun 2008
Location: Australia
Posts: 43
Rep Power: 0
javanewbie is on a distinguished road
Default Java heap space?
int aiNumbers[][] = new int[number] [number];

what is the maximum number that can be entered here?
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 06-24-2008, 07:55 PM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 1,018
Rep Power: 3
Nicholas Jordan is on a distinguished road
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 [][]

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:
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
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Heap Space sandeeprao.techno Advanced Java 19 10-30-2008 12:27 PM
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space Eku NetBeans 14 06-12-2008 09:36 AM
Heap Sort in Java Java Tip Algorithms 0 04-16-2008 11:27 PM
java.lang.OutOfMemoryError: Java heap space paul Advanced Java 1 07-25-2007 09:07 PM
Java Heap Out of Memory Error stonkers New To Java 3 07-17-2007 05:43 PM


All times are GMT +2. The time now is 03:00 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org