2

スレッドを拡張するクラスがあります。

その中で、私の run() メソッドには while ループがあります。

HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
input = new BufferedInputStream(urlConnection.getInputStream());
output = new FileOutputStream(localFile, true);                                                             
urlConnection.setReadTimeout(10000); 
byte data[] = new byte[16384]; 

while ((count = input.read(data)) != -1) {
    output.write(data, 0, count);
}

ICS以上を対象としています。ダウンロードしているとき、logcat で大量のガベージ コレクションが発生しています。些細な方法のように思えますが、ここで間違っていることはありますか? データ配列を作成するのは 1 回だけです。

4

0 に答える 0