Why do you think I am getting this error message?
“java.lang.OutOfMemoryError: Cannot allocate new IntPointer(1): totalBytes = 8, physicalBytes = 7249M”
I think it’s because of this class I wrote that colors a greyscale image to look like topography. It will crash at different times. Sometimes minutes in. Sometimes hours in.
What can I think of to fix this?
Thank you for any tips!
void Colorrr() {
// Loop through every pixel
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
color c = get(i, j);
b = int(brightness(c));
//println(b);
// Adjust the level of terrain
b = b + adjust;
// Absolute lowest Layer
if (b < 14) {
set(i, j, color(0, 2, 40));
}
//Start Water
else if (b > 14 && b <= 28) {
set(i, j, color(0, 5, 60));
} else if (b > 28 && b <= 42) {
set(i, j, color(0, 10, 82));
} else if (b > 42 && b <= 56) {
set(i, j, color(13, 47, 144));
} else if (b > 56 && b <= 70) {
set(i, j, color(54, 130, 225));
} else if (b > 70 && b <= 84) {
set(i, j, color(0, 210, 123));
}
// Start Land
else if (b > 84 && b <= 98) {
set(i, j, color(238, 236, 62));
} else if (b > 98 && b <= 112) {
set(i, j, color(163, 242, 51));
} else if (b > 112 && b <= 126) {
set(i, j, color(51, 230, 52));
} else if (b > 126 && b <= 140) {
set(i, j, color(26, 187, 0));
} else if (b > 140 && b <= 154) {
set(i, j, color(75, 125, 11));
} else if (b > 154 && b <= 168) {
set(i, j, color(82, 114, 15));
}
// Start Mountain
else if (b > 168 && b <= 182) {
set(i, j, color(89, 68, 10));
} else if (b > 182 && b <= 196) {
set(i, j, color(61, 47, 10));
}
// Start Snow
else if (b > 196 && b <= 210) {
set(i, j, color(190, 200, 230));
} else if (b > 210 && b <= 224) {
set(i, j, color(230, 248, 255));
} else if (b > 224 && b <= 238) {
set(i, j, color(211, 248, 255));
} else if (b > 238) {
set(i, j, color(222, 252, 255));
}
//else {
// set(i, j, c);
//}
}
}
// End of coloring
}