I have a very strange memory problem with my Android app. My app use 3 classes that are the following:
public class RGB
{
public int R;
public int G;
public int B;
}
public class CMYK
{
public int C;
public int M;
public int Y;
public int K;
}
public class COLOR
{
public String id;
public CMYK cmyk = new CMYK();
public RGB rgb = new RGB();
public COLOR(String id, int c, int m, int y, int k, int r, int g, int b)
{
this.id = id;
this.cmyk.C = c;
this.cmyk.M = m;
this.cmyk.Y = y;
this.cmyk.K = k;
this.rgb.R = r;
this.rgb.G = g;
this.rgb.B = b;
}
}
then somewere in the code I have to load 2000 colors from a file (file is about 65K lenght and has exactly 2000 records) and is placed in assets folder
public COLOR[] color_list = new COLOR[2000];
...
...
do
{
s = reader.readLine();
if (s != null)
{
String[] x = s.split(" ");
COLOR c = new COLOR(x[0], Integer.parseInt(x[1]), Integer.parseInt(x[2]), Integer.parseInt(x[3]), Integer.parseInt(x[4]), Integer.parseInt(x[5]), Integer.parseInt(x[6]), Integer.parseInt(x[7]));
color_list[j++] = c;
}
} while (s != null);
after this the app will crash and stop working. If I remove the do..while all is working, so I think my array will be more and more and more then 65K, what I have done wrong? On Android LogCat I have reached the full of HEAP space (26MB) !!!
Best regards GMG