在图像流上获得大量内存泄漏

时间:2013-10-22 00:31:31

标签: android eclipse memory-leaks

我试图在特定的x秒刷新图像,几分钟后内存泄漏。

我正在

下获取代码
try {
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpClient.execute(httpPost);
byte[] imageBytes = IOUtils.toByteArray(response.getEntity().getContent());
final Bitmap bmp = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);
return bmp;
}

然后在一段时间后刷新: REFRESH_DELAY = 2000 REFRESH_DELAY_SLOW = 6000

public void onResume() {
super.onResume();
mThreadPool = Executors.newScheduledThreadPool(2);
mBackgroundTask = mThreadPool.scheduleWithFixedDelay(mRefreshRunable,0,Connectivity.isConnectedFast(getActivity()) ? Config.REFRESH_DELAY : Config.REFRESH_DELAY_SLOW,
TimeUnit.MILLISECONDS);
}

我得到的日志:

GC_FOR_ALLOC freed 1286K, 16% free 21943K/26064K, paused 44ms, total 44ms
GC_FOR_ALLOC freed 1296K, 16% free 21943K/26064K, paused 44ms, total 44ms
GC_FOR_ALLOC freed 1285K, 16% free 21943K/26064K, paused 44ms, total 44ms
GC_FOR_ALLOC freed 1286K, 16% free 21943K/26064K, paused 44ms, total 45ms
GC_FOR_ALLOC freed 1285K, 16% free 21943K/26064K, paused 47ms, total 48ms
GC_FOR_ALLOC freed 1286K, 16% free 21943K/26064K, paused 44ms, total 45ms
GC_FOR_ALLOC freed 1285K, 16% free 21943K/26064K, paused 43ms, total 44ms
GC_FOR_ALLOC freed 1286K, 16% free 21943K/26064K, paused 44ms, total 45ms
GC_FOR_ALLOC freed 1285K, 16% free 21943K/26064K, paused 44ms, total 45ms

0 个答案:

没有答案