Results 1 to 5 of 5
  1. #1
    someone is offline Member
    Join Date
    Apr 2011
    Posts
    18
    Rep Power
    0

    Default Problem JAVA HEAP SPACE !!

    I got this problem

    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at hw5.arrayconvert.main(arrayconvert.java:109)
    Java Result: 1
    BUILD SUCCESSFUL (total time


    any one know how to solve it

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Possibly, It's a logic error more than likely, you must have some sort of infinite loop/recursive process being performed. It's hard to say without seeing some code.

    Highlight your code and click the code button, or click the code button and then paste your code between them.


    Also, is anyone else having trouble displaying code tags with ascii? When I do [/code](using ascii & #101; ) in the opening and closing tags it creates actual tags.
    Last edited by sunde887; 04-30-2011 at 12:07 AM.

  3. #3
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    Indeed hard to say if this is a programming error, or an error with simply running out of room while trying to allocated lots of memory. Change the maximum memory for the JRE using the -Xmx parameter (for example, set the max memory to 512mb by using -Xmx512m)

  4. #4
    someone is offline Member
    Join Date
    Apr 2011
    Posts
    18
    Rep Power
    0

    Default

    Java Code:
    static int ArrMyarray[] = new int[188116185];
    
       public void searchInDirectAddressTable(String input) {
            int position = ConvertToInt(input);
            if (ArrMyarray[position] !=0) {
                System.out.println("Found at position " + position);
            } else {
                System.out.println("Not found");
            }
        }
    I try to put some values in the direct addressing table.

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,435
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by someone View Post
    Java Code:
    static int ArrMyarray[] = new int[188116185];
    Did you know that a single int takes four bytes of memory? Do your math.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Image Problem overflowing Heap Space
    By The Bear Jew in forum Java 2D
    Replies: 4
    Last Post: 10-16-2010, 06:58 PM
  2. Replies: 0
    Last Post: 06-28-2010, 12:30 PM
  3. Heap Space Problem
    By segolas in forum Advanced Java
    Replies: 6
    Last Post: 01-14-2010, 11:29 AM
  4. Problem with Java Heap Space using Socket
    By mvillara in forum Networking
    Replies: 3
    Last Post: 08-21-2009, 04:45 AM
  5. Java heap space?
    By javanewbie in forum New To Java
    Replies: 1
    Last Post: 06-24-2008, 06:55 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
  •