flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

How to control the total size of cached images.

Open lan2000 opened this issue 3 years ago • 0 comments

🐛 Bug Report

List built with listview.build. The list is long and there are pictures in the list. This image has "memCacheHeight" set. Keep scrolling the list, and an error occurs after ten minutes. If I don't set memCacheHeight, after sliding the list for a period of time, the program directly freezes, prompting "the program is not responding". How to control the total size of cached images. I set PaintingBinding.instance.imageCache.maximumSizeBytes = 1024*1024*80; and it didn't work.

log:

CursorWindow: mmap() failed: errno=12.

 DatabaseException(Could not allocate CursorWindow '/data/user/0/package/files/libCachedImageData.db' of size 2097152 due to error -12.) sql 'SELECT * FROM cacheObject WHERE key = ?' args [https://.....jpg]

I/flutter (27560): #0      wrapDatabaseException (package:sqflite/src/exception_impl.dart:11)
I/flutter (27560): <asynchronous suspension>
I/flutter (27560): #1      SqfliteDatabaseMixin.txnRawQuery.<anonymous closure> (package:sqflite_common/src/database_mixin.dart:404)
I/flutter (27560): <asynchronous suspension>
I/flutter (27560): #2      BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33)
I/flutter (27560): <asynchronous suspension>
I/flutter (27560): #3      SqfliteDatabaseMixin.txnSynchronized (package:sqflite_common/src/database_mixin.dart:344)
I/flutter (27560): <asynchronous suspension>
I/flutter (27560): #4      CacheObjectProvider.get (package:flutter_cache_manager/src/storage/cache_info_repositories/cache_object_provider.dart:110)
I/flutter (27560): <asynchronous suspension>
I/flutter (27560): #5      CacheStore._getCacheDataFromDatabase (package:flutter_cache_manager/src/cache_store.dart:116)
I/flutter (27560): <asynchronous suspension>


E/CursorWindow(27560): CursorWindow: mmap() failed: errno=12.
W/Binder  (27560): Caught a RuntimeException from the binder stub implementation.
W/Binder  (27560): android.database.CursorWindowAllocationException: Could not allocate CursorWindow 'collectDbStats' of size 2097152 due to error -12.
W/Binder  (27560): 	at android.database.CursorWindow.nativeCreate(Native Method)
W/Binder  (27560): 	at android.database.CursorWindow.<init>(CursorWindow.java:139)
W/Binder  (27560): 	at android.database.CursorWindow.<init>(CursorWindow.java:120)
W/Binder  (27560): 	at android.database.sqlite.SQLiteConnection.collectDbStats(SQLiteConnection.java:1266)
W/Binder  (27560): 	at android.database.sqlite.SQLiteConnectionPool.collectDbStats(SQLiteConnectionPool.java:536)
W/Binder  (27560): 	at android.database.sqlite.SQLiteDatabase.collectDbStats(SQLiteDatabase.java:2328)
W/Binder  (27560): 	at android.database.sqlite.SQLiteDatabase.getDbStats(SQLiteDatabase.java:2319)
W/Binder  (27560): 	at android.database.sqlite.SQLiteDebug.getDatabaseInfo(SQLiteDebug.java:181)
W/Binder  (27560): 	at android.app.ActivityThread$ApplicationThread.dumpMemInfo(ActivityThread.java:1540)
W/Binder  (27560): 	at android.app.ActivityThread$ApplicationThread.dumpMemInfo(ActivityThread.java:1500)
W/Binder  (27560): 	at android.app.IApplicationThread$Stub.onTransact(IApplicationThread.java:1115)
W/Binder  (27560): 	at android.os.Binder.execTransactInternal(Binder.java:1028)
W/Binder  (27560): 	at android.os.Binder.execTransact(Binder.java:1001)
W/libc    (27560): realloc(0xb9a52300, 11264) failed: returning null pointer
E/Dart    (27560): ../../third_party/dart/runtime/platform/allocation.cc: 22: error: Out of memory.
E/DartVM  (27560): version=2.18.0 (stable) (Fri Aug 26 10:22:54 2022 +0000) on "android_arm"
E/DartVM  (27560): pid=27560, thread=8185, isolate_group=vm-service(0xd815f400), isolate=(nil)(0x0)
E/DartVM  (27560): isolate_instructions=b6946b70, vm_instructions=b47ff000
E/DartVM  (27560):   pc 0xb7facfbf fp 0x0437a178 /data/app/package-XCUByTN3Jo9rSXkvodxNRg==/lib/arm/libflutter.so+0x9abfbf
E/DartVM  (27560): -- End of DumpStackTrace
F/libc    (27560): Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 8185 (DartWorker), pid 27560 (package)

**Version:cached_network_image 3.2.2

Platform:

[√] Flutter (Channel stable, 3.3.0, on Microsoft Windows [版本 10.0.19042.630], locale zh-CN)
    • Flutter version 3.3.0 on channel stable at D:\flutter\flutter
    • Upstream repository https://github.com/flutter/flutter/
    • FLUTTER_GIT_URL = https://github.com/flutter/flutter/
    • Framework revision ffccd96b62 (7 days ago), 2022-08-29 17:28:57 -0700
    • Engine revision 5e9e0e0aa8
    • Dart version 2.18.0
    • DevTools version 2.15.0
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

WLZ AL10 (mobile)      • FMLDU19C13016286 • android-arm64  • Android 10 (API 29)

lan2000 avatar Sep 06 '22 07:09 lan2000