Page 2 of 2 FirstFirst 12
Results 21 to 21 of 21
Like Tree1Likes

Thread: Java Heap Space Error...

  1. #21
    SJF
    SJF is offline Senior Member
    Join Date
    Oct 2012
    Posts
    108
    Rep Power
    0

    Default Re: Java Heap Space Error...

    In a 3x2x6x6x4x5 6-D array you have 4320 data points.

    That is you have 1 6-D Array.
    You have 3 5-D Arrays
    You have 6 4-D Arrays
    You have 36 3-D Arrays
    You have 216 2-D Arrays
    For a total of 864 Length 5 1-D Arrays -> 864 * 5 = 4320.

    Your Sum for loops are performing a total of 4320+864+216+36+6+3 additions for a total of 5445 additions. The extra 1125 additions are the most likely cause of the discrepancy.

    Java Code:
    Sum += DATA[i][j][k][l][m][n].Sum;  // First iteration this is Sum += DATA[0][0][0][0][0][0].Sum
                                                     // Second iteration this is Sum += DATA[0][0][0][0][0][1].Sum
                                                     // Sixth iteration this is Sum += DATA[0][0][0][0][1][0].Sum
    Last edited by SJF; 03-17-2013 at 01:02 AM. Reason: 5 +5 (864 5s, not 5 864s)

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Java Heap Space Error
    By wanna learn more :) in forum Advanced Java
    Replies: 3
    Last Post: 03-26-2012, 01:35 PM
  2. Java Heap space error using ArrayList.
    By AcousticBruce in forum New To Java
    Replies: 13
    Last Post: 01-03-2011, 02:06 PM
  3. Replies: 5
    Last Post: 08-13-2010, 11:04 AM
  4. java out of memory error-heap space error
    By elsanthosh in forum NetBeans
    Replies: 4
    Last Post: 06-15-2010, 10:31 AM
  5. Java heap space error
    By gezzel in forum New To Java
    Replies: 19
    Last Post: 09-25-2008, 01:07 AM

Posting Permissions

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