Yalantis / Phoenix

Phoenix Pull-to-Refresh
https://yalantis.com/
Apache License 2.0
4.01k stars 916 forks source link

bug with oom had happen more than 573 in my project #22

Closed qq2748 closed 8 years ago

qq2748 commented 8 years ago

java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:575) at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:410) at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:433) at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:463) at com.yalantis.phoenix.refresh_view.SunRefreshView.createBitmaps(SunRefreshView.java:108) at com.yalantis.phoenix.refresh_view.SunRefreshView.initiateDimens(SunRefreshView.java:104) at com.yalantis.phoenix.refresh_view.SunRefreshView$1.run(SunRefreshView.java:81) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5062) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132) at dalvik.system.NativeStart.main(Native Method)

基本信息 首次发生时间 最近发生时间 出现次数 版本 2015-11-20 16:16:21 2015-11-24 18:49:33 573 2.2 qq 20151126120534

MummyDing commented 8 years ago

11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: FATAL EXCEPTION: main 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: Process: com.mummyding.app.leisure, PID: 7808 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: java.lang.OutOfMemoryError: Failed to allocate a 3032652 byte allocation with 2718848 free bytes and 2MB until OOM 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at dalvik.system.VMRuntime.newNonMovableArray(Native Method) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at android.graphics.Bitmap.nativeCreate(Native Method) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at android.graphics.Bitmap.createBitmap(Bitmap.java:831) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at android.graphics.Bitmap.createBitmap(Bitmap.java:808) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at android.graphics.Bitmap.createBitmap(Bitmap.java:739) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:615) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at com.yalantis.phoenix.refresh_view.SunRefreshView.createBitmaps(SunRefreshView.java:109) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at com.yalantis.phoenix.refresh_view.SunRefreshView.initiateDimens(SunRefreshView.java:104) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at com.yalantis.phoenix.refresh_view.SunRefreshView$1.run(SunRefreshView.java:81) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 11-28 07:48:35.040 7808-7808/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

shliama commented 8 years ago

@qq2748 Hello and thanks for the report. I'll investigate it asap :+1:

shliama commented 8 years ago

@qq2748 So, first of all I've created an update for the lib (1.2.3), libraries and tools version were updated and also I've added RGB_565 flag to the Bitmap decode options. It reduced space that Bitmaps allocate. However, I haven't found any memory leaks, at least not in sample. My advice is to use memory allocation analyse tools to find any memory leaks that could happen. (If your activity that holds PullToRefreshView is leaked, those heavy Bitmaps objects will just be duplicated over and over). App crashes in place where the Bitmaps are created, but this doesn't mean that this is the cause of the problem, it's just a trigger for OOM.

kiaanpillay commented 8 years ago

I also am getting OOM Errors, I am using tiny files buildings-19kb, sky - 34kb, sun 6kb