TedBottomPicker icon indicating copy to clipboard operation
TedBottomPicker copied to clipboard

Possible memory leak? Using dialog from a fragment

Open StephenMilone opened this issue 8 years ago • 4 comments

I have my app setup with a main activity and a navigation drawer that flips between fragments. One of the fragments uses the ted bottom picker, on 1.0.8 I seem to be getting a memory leak.

Here is the exception followed by LeakCanary's analysis:

01-18 19:02:45.340 2957-2975/com.example W/FastPrintWriter: Write failure java.io.IOException: write failed: EPIPE (Broken pipe) at libcore.io.IoBridge.write(IoBridge.java:501) at java.io.FileOutputStream.write(FileOutputStream.java:316) at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:336) at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:359) at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:394) at android.view.WindowManagerGlobal.dumpGfxInfo(WindowManagerGlobal.java:584) at android.app.ActivityThread$ApplicationThread.dumpGfxInfo(ActivityThread.java:1175) at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:577) at android.os.Binder.execTransact(Binder.java:565) Caused by: android.system.ErrnoException: write failed: EPIPE (Broken pipe) at libcore.io.Posix.writeBytes(Native Method) at libcore.io.Posix.write(Posix.java:273) at libcore.io.BlockGuardOs.write(BlockGuardOs.java:319) at libcore.io.IoBridge.write(IoBridge.java:496) at java.io.FileOutputStream.write(FileOutputStream.java:316) at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:336) at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:359) at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:394) at android.view.WindowManagerGlobal.dumpGfxInfo(WindowManagerGlobal.java:584) at android.app.ActivityThread$ApplicationThread.dumpGfxInfo(ActivityThread.java:1175) at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:577) at android.os.Binder.execTransact(Binder.java:565) 01-18 19:02:45.349 2957-2975/com.example W/FastPrintWriter: Write failure java.io.IOException: write failed: EPIPE (Broken pipe) at libcore.io.IoBridge.write(IoBridge.java:501) at java.io.FileOutputStream.write(FileOutputStream.java:316) at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:336) at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:359) at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:394) at android.view.WindowManagerGlobal.dumpGfxInfo(WindowManagerGlobal.java:584) at android.app.ActivityThread$ApplicationThread.dumpGfxInfo(ActivityThread.java:1175) at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:577) at android.os.Binder.execTransact(Binder.java:565) Caused by: android.system.ErrnoException: write failed: EPIPE (Broken pipe) at libcore.io.Posix.writeBytes(Native Method) at libcore.io.Posix.write(Posix.java:273) at libcore.io.BlockGuardOs.write(BlockGuardOs.java:319) at libcore.io.IoBridge.write(IoBridge.java:496) at java.io.FileOutputStream.write(FileOutputStream.java:316) at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:336) at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:359) at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:394) at android.view.WindowManagerGlobal.dumpGfxInfo(WindowManagerGlobal.java:584) at android.app.ActivityThread$ApplicationThread.dumpGfxInfo(ActivityThread.java:1175) at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:577) at android.os.Binder.execTransact(Binder.java:565) 01-18 19:03:07.020 2957-4410/com.example D/LeakCanary: In com.example:1.0:1. 01-18 19:03:07.020 2957-4410/com.example D/LeakCanary: * com.current.app.ui.main.MainActivity has leaked: 01-18 19:03:07.020 2957-4410/com.example D/LeakCanary: * GC ROOT static gun0912.tedbottompicker.TedBottomPicker.builder 01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * references gun0912.tedbottompicker.TedBottomPicker$Builder.context 01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * leaks com.current.app.ui.main.MainActivity instance 01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * Retaining: 484 KB. 01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * Reference Key: 1a66aa7f-b26e-447f-b322-d4777524e49a 01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * Device: unknown Android Android SDK built for x86_64 sdk_google_phone_x86_64 01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * Android Version: 7.1 API: 25 LeakCanary: 1.5 00f37f5 01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * Durations: watch=5062ms, gc=154ms, heap dump=4781ms, analysis=21586ms

To trigger this all i do is create the dialog then pick gallery image then back out of the app via back button. I even commented out all the code I do with the returned uri.

Occurs on 7.1 real device, 7.1 simulator and 4.4 simulator. write storage permission granted for all.

Let me know what other info could help.

StephenMilone avatar Jan 19 '17 00:01 StephenMilone

@StephenMilone When you select image from gallery, do you have this problem? Right?

ParkSangGwon avatar Feb 22 '17 04:02 ParkSangGwon

Yes exactly

StephenMilone avatar Feb 22 '17 15:02 StephenMilone

Can you update library version?

ParkSangGwon avatar Sep 27 '17 02:09 ParkSangGwon

I am using Fragment and this library gives me error (show red color code ) of getSupportFragmentManager

What is the error? and what I should use in fragment in order to remove this error. Please help me quicker

FazliMolaJan avatar Dec 24 '17 17:12 FazliMolaJan