Note that there are some explanatory texts on larger screens.

plurals
  1. PO"java.lang.OutOfMemoryError: Java heap space" in image and array storage
    primarykey
    data
    text
    <p>I am currently working on an image processing demonstration in java (Applet).</p> <p>I am running into the problem where my arrays are too large and I am getting the "java.lang.OutOfMemoryError: Java heap space" error.</p> <p>The algorithm I run creates an NxD float array where: N is the number of pixel in the image and D is the coordinates of each pixel plus the colorspace components of each pixel (usually 1 for grayscale or 3 for RGB). For each iteration of the algorithm it creates one of these NxD float arrays and stores it for later use in a vector, so that the user of the applet may look at the individual steps.</p> <p>My client wants the program to be able to load a 500x500 RGB image and run as the upper bound. There are about 12 to 20 iterations per run so that means I need to be able to store a 12x500x500x5 float in some fashion.</p> <p>Is there a way to process all of this data and, if possible, how?</p> <p>Example of the issue: I am loading a 512 by 512 Grayscale image and even before the first iteration completes I run out of heap space. The line it points me to is: </p> <p>Y.add(new float[N][D])</p> <p>where Y is a Vector and N and D are described as above. This is the second instance of the code using that line.</p> <p>EDIT: The upper bound, as I mentioned but forgot to correct should be around: 20+ x500x500x5 (20 iterations, 500 width, 500 height, 5 dimensions (where 3 comes from RGB and 2 for the coordinates (The coordinates move and so do the pixels, so I need to record the values, which can and are decimals)) (Approx. 100000000 bytes)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload