Baseflow / flutter_cached_network_image

Download, cache and show images in a flutter app
https://baseflow.com
2.45k stars 657 forks source link

Picture download memory explosion #663

Open baneyue opened 3 years ago

baneyue commented 3 years ago

🐛 Bug Report

When I am on Windows platform, listview has 7000 pieces of data and loads pictures. The size of each picture is about 100kb. I see that disk cache is not enabled and the network speed instantly reaches 30-60mb / s.

Whether the concurrent download queue and the number of concurrent downloads can be manually set;

Whether disk cache can be provided;

At present, I feel that there are still basic performance problems with this library.

Expected behavior

Reproduction steps

Configuration

Version: 3.1.0

Platform:

renefloor commented 3 years ago

What do you mean with disk cache is not enabled? Last time I tested on Windows disk cache was working perfectly fine. I you think this package has basic performance problems you are free to use a different package or make your own.

baneyue commented 3 years ago

when Listview loads thousands of item pictures, and the memory soars. It is found that the network bandwidth reaches 30MB / s, which eventually leads to the software being killed by anti-virus software.

This framework recommends performance testing

renefloor commented 3 years ago

The cache manager already includes queueing for the download, so not to many images are downloaded at the same time. Would you recommend limiting the maximum download speed? I wouldn't know why we shouldn't download as soon as possible. As an app developer you are also responsible yourself for not showing/downloading thousands of (huge) pictures at the same time. If you really want to show thousands of pictures you should download very small versions of them. If you have a very big list you should use ListView.builder so only images are downloaded which are being shown.

baneyue commented 3 years ago

We have used listview.builder. When we find that the pictures are not visible, we will still download them. This problem will occur when we use the scroll bar to scroll quickly. Network bandwidth and CPU will soar at the same time

baneyue commented 3 years ago

Is there any progress on this issue

It's really a big problem

baneyue commented 3 years ago

When you quickly drag the scroll bar, the network speed will soon reach more than 20m / s, and then it will be killed as an exception by the anti-virus software. I mean, the number of pictures loaded in parallel is too large, and the control of rolling out of the screen has not been cancelled.

企业微信截图_16364515438502 @renefloor

anirudhsharma392 commented 3 years ago

for now lowering the value of memCacheHeight helped me, but it's a temporary fix !

renefloor commented 3 years ago

@baneyue is this really different when you use NetworkImage instead of CachedNetworkImage?

baneyue commented 3 years ago

yes , The performance problem is the biggest problem of cachednetworkimage, and there is no good solution at present

Klabauterman commented 2 years ago

I am having the same problem. I am even getting out of memory exceptions.

boomery commented 2 months ago

same problem, do you got any solution for this ?