Android アプリで非常に奇妙なメモリの問題が発生しています。私のアプリは、次の 3 つのクラスを使用します。
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;
}
}
次に、ファイルから2000色をロードする必要があるコードの一部(ファイルの長さは約65Kで、正確に2000のレコードがあります)がアセットフォルダーに配置されます
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);
この後、アプリはクラッシュして動作を停止します。すべてが機能している間にdo..を削除すると、アレイがますます65Kを超えると思いますが、何が間違っていますか? Android LogCat で、HEAP スペース (26MB) がいっぱいになりました!!!
よろしくお願いします GMG