shixinzhang / androidbitmapmonitor Goto Github PK
View Code? Open in Web Editor NEWA bitmap memory usage monitor for Android. Android 图片内存分析工具,可以帮助发现应用的图片使用是否合理。
License: Apache License 2.0
A bitmap memory usage monitor for Android. Android 图片内存分析工具,可以帮助发现应用的图片使用是否合理。
License: Apache License 2.0
_ZN7android6bitmap12createBitmapEP7_JNIEnvPNS_6BitmapEiP11_jbyteArrayP8_jobjecti 你好请教个问题 这个函数符号你是怎么获取的
版本1.1.0
手机 pixel 3XL
已开启悬浮窗权限
Caused by android.app.BackgroundServiceStartNotAllowedException
Not allowed to start service Intent { flg=0x10000000 cmp=com.hk.azal.live/top.shixinzhang.bitmapmonitor.ui.FloatWindowService }: app is in background uid UidRecord{8e253cc u0a217 TRNB idle change:uncached procs:0 seq(0,0,0)}
implementation "io.github.shixinzhang:android-bitmap-monitor:1.1.0"
val ctx = ContextUtils.getApplication()
val cacheFile = File(ctx.cacheDir, "bitmap_monitor")
if (!cacheFile.exists()) {
cacheFile.mkdirs()
}
val config = BitmapMonitor.Config.Builder()
// 检查图片是否被回收的间隔,单位:秒 (建议不要太频繁,默认 5秒)
.checkRecycleInterval(10L)
// 获取堆栈的阈值,当一张图片占据的内存超过这个数值后就会去抓栈
.getStackThreshold(100 * 1024L)
// 还原图片的阈值,当一张图占据的内存超过这个数值后,就会还原出一张原始图片
.restoreImageThreshold(100 * 1024L)
.restoreImageDirectory(cacheFile.absolutePath)
// 是否展示悬浮窗,可实时查看内存大小(建议只在 debug 环境打开)
.showFloatWindow(true)
// 重启后清除本地所有文件(目前不支持展示历史数据,所以默认清除本地所有)
.clearAllFileWhenRestartApp(true)
// 运行时超出阈值就清理
.clearFileWhenOutOfThreshold(false)
// 本地图片缓存写入上限,单位为 byte,默认大小为 512MB,超出后会立刻删除
.diskCacheLimitBytes(100 * 1024 * 1024L)
.isDebug(true)
.context(ctx)
.build()
BitmapMonitor.init(config)
java.lang.NullPointerException
at java.io.File.<init>(File.java:283)
at top.shixinzhang.bitmapmonitor.internal.BitmapFileWatcher.loadAllFileToMemory(BitmapFileWatcher.java:103)
at top.shixinzhang.bitmapmonitor.internal.BitmapFileWatcher.$r8$lambda$hPaKz5jeLLZ9ow_IMx3UtPDtUb8(Unknown Source:0)
at top.shixinzhang.bitmapmonitor.internal.BitmapFileWatcher$$ExternalSyntheticLambda0.run(Unknown Source:0)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
大佬,bitmap_monitor.cpp 里的 LOGI 是不是可以支持下设置是否打印?量有点太大了,而且 level 还是 info。
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: 'art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI FindClass called with pending exception 'java.lang.NoSuchFieldError' thrown in java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String):-2'
打开MainActivity,有15张图片。回退到上一个页面,bitmap数量和大小,没有任何减少
每次启动都会将超出阈值的图片写入不同的文件,多打开几次后,bitmap_monitor 目录下的文件越来越多,可能造成存储耗尽
大佬参考下leakcanary,期望开发期间能发现问题并修正,但是正式上线后不希望有代码编译运行到用户真实环境中。
堆栈如下
2023-07-26 14:16:29.428 13596-13596 libc com.test.bitmapmonitor A Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 13596 (.bitmapmonitor), pid 13596 (.bitmapmonitor)
2023-07-26 14:16:29.949 13846-13846 DEBUG pid-13846 A Cmdline: com.test.bitmapmonitor
2023-07-26 14:16:29.949 13846-13846 DEBUG pid-13846 A pid: 13596, tid: 13596, name: .bitmapmonitor >>> com.test.bitmapmonitor <<<
2023-07-26 14:16:29.949 13846-13846 DEBUG pid-13846 A #1 pc 000000000000c5c8 /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/lib/arm64/libshadowhook.so (shadowhook_get_prev_func+12) (BuildId: a5399f0d11c4ec1244543780f0a31f2d62857f74)
2023-07-26 14:16:29.949 13846-13846 DEBUG pid-13846 A #2 pc 0000000000015ea4 /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/lib/arm64/libbitmapmonitor.so (create_bitmap_proxy(_JNIEnv*, void*, int, _jbyteArray*, _jobject*, int)+84) (BuildId: 97cfffda4c5cd149ae932e86d1bde0a7a74def05)
2023-07-26 14:16:29.949 13846-13846 DEBUG pid-13846 A #101 pc 00000000002ef00c [anon:dalvik-classes.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk]
2023-07-26 14:16:29.949 13846-13846 DEBUG pid-13846 A #107 pc 00000000002ef6b0 [anon:dalvik-classes.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk]
2023-07-26 14:16:29.950 13846-13846 DEBUG pid-13846 A #110 pc 00000000001e51a6 [anon:dalvik-classes.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk]
2023-07-26 14:16:29.950 13846-13846 DEBUG pid-13846 A #116 pc 00000000001d829a [anon:dalvik-classes.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk]
2023-07-26 14:16:29.950 13846-13846 DEBUG pid-13846 A #122 pc 00000000001ecaac [anon:dalvik-classes.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk]
2023-07-26 14:16:29.950 13846-13846 DEBUG pid-13846 A #128 pc 00000000001bae64 [anon:dalvik-classes.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk]
2023-07-26 14:16:29.950 13846-13846 DEBUG pid-13846 A #134 pc 00000000001bb278 [anon:dalvik-classes.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk]
2023-07-26 14:16:29.950 13846-13846 DEBUG pid-13846 A #140 pc 00000000001bb44a [anon:dalvik-classes.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk]
2023-07-26 14:16:29.950 13846-13846 DEBUG pid-13846 A #146 pc 00000000001b6e26 [anon:dalvik-classes.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk]
2023-07-26 14:16:29.950 13846-13846 DEBUG pid-13846 A #152 pc 00000000001b07f0 [anon:dalvik-classes.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk]
2023-07-26 14:16:29.950 13846-13846 DEBUG pid-13846 A #158 pc 00000000001afd06 [anon:dalvik-classes.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk]
2023-07-26 14:16:29.950 13846-13846 DEBUG pid-13846 A #164 pc 000000000034c918 [anon:dalvik-classes.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk]
2023-07-26 14:16:29.950 13846-13846 DEBUG pid-13846 A #170 pc 00000000001ee030 [anon:dalvik-classes12.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk!classes12.dex]
2023-07-26 14:16:29.950 13846-13846 DEBUG pid-13846 A #176 pc 00000000000e4e14 [anon:dalvik-classes3.dex extracted in memory from /data/app/~~lPYxXLZv8f1xO1wzNk9G8g==/com.test.bitmapmonitor-9YoIsvqFII-QxHf9xKU2GQ==/base.apk!classes3.dex]
是fresco本身就没支持吗
oppo findx3 android13手机上看不到预览图
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.