Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: OutOfMemory java heap size

  1. #1
    Join Date
    Mar 2011
    Thanked 0 Times in 0 Posts

    Default OutOfMemory java heap size

    Hi... Currently I am doin the k nearest neighbour classification using java.. The data size for training data set and test data set consist of 10k samples each.. I have to calculate the distance for the data set.. So I create and 2D array to store them as for all samples in training data set have to calculate to each sample in the test data set... So the dimension of my 2d array is dist[10000][10000] and this seems to cause the exception... I would like to check whether any1 got an idea to solve this???

  2. #2
    Join Date
    Jun 2011
    My Mood
    Thanked 8 Times in 8 Posts

    Default Re: OutOfMemory java heap size

    Where is the data stored? Or do you have to generate it? The smartest solution is to break it down into chunks, only 1000 rows at a time perhaps.

    The lazy solution (assuming your computer has enough RAM) is to just give Java more memory with -Xmx####M

Similar Threads

  1. java.lang.outOfMemory heap space
    By totadan in forum Java Theory & Questions
    Replies: 1
    Last Post: June 25th, 2012, 04:56 PM
  2. Replies: 0
    Last Post: March 22nd, 2012, 09:13 AM
  3. heap size vs heap used
    By aueddonline in forum Java Theory & Questions
    Replies: 5
    Last Post: February 10th, 2012, 01:59 PM
  4. Increase heap size; 4 GB wall?
    By BKB in forum What's Wrong With My Code?
    Replies: 4
    Last Post: July 13th, 2010, 08:55 PM
  5. AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
    By nasi in forum What's Wrong With My Code?
    Replies: 6
    Last Post: March 25th, 2010, 10:37 PM