the wrap.* properties are broken in AOSP right now... (they're broken in S too.)
here's the workaround to make the wrap. properties work: adb shell setprop dalvik.vm.force-java-zygote-fork-loop true adb shell stop adb shell start the commands you're using don't look right ... try this instead: adb shell setprop wrap.<app_name> '"LIBC_DEBUG_MALLOC_OPTIONS=backtrace=4 logwrapper"' and then restart the app. On Tue, Feb 22, 2022 at 6:15 PM SHUBHAM SALUNKHE < salunkheshubham1...@gmail.com> wrote: > Hi, > Thanks for reply. > I have added debug statement as follows > in system/memory/libmemunreachable/MemUnreachable.cpp. i giving "No. of > Frames:0". that's why backtrace call is not happening. How it is possible > if adb shell is giving memory leak address but backtrace frames are not > available? > > *Debug tatement:-* > ssize_t num_backtrace_frames = > malloc_backtrace(reinterpret_cast<void*>(it.range.begin), > leak->backtrace.frames, leak->backtrace.max_frames); > MEM_ALOGI("No. of Frames: %zd",num_backtrace_frames); > if (num_backtrace_frames > 0) { > leak->backtrace.num_frames = num_backtrace_frames; > > *adb shell output:* > Unreachable memory > 704 bytes in 5 unreachable allocations > ABI: 'arm64' > > 288 bytes unreachable at 7862adf450 > first 20 bytes of contents: > 7862adf450: 88 13 e8 07 00 00 00 00 9e 9f 15 08 00 00 00 00 > ................ > 7862adf460: 2c bb 17 08 00 00 00 00 23 8a 89 08 00 00 00 00 > ,.......#....... > > Thanks & Regards, > Shubham Salunkhe > On Wednesday, February 16, 2022 at 2:52:17 AM UTC+5:30 e...@google.com > wrote: > >> oh, and if you're on a recent AOSP build, you might want to try >> cherrypicking >> https://android-review.googlesource.com/c/platform/frameworks/base/+/1978990 >> --- the `wrap.` system properties are a bit broken atm. (the wrap.sh stuff >> for apps works fine though.) >> >> On Tue, Feb 15, 2022 at 12:40 PM enh <e...@google.com> wrote: >> >>> you did replace `[process]` with your actual process name, right? >>> >>> On Tue, Feb 15, 2022 at 12:29 PM SHUBHAM SALUNKHE < >>> salunkhes...@gmail.com> wrote: >>> >>>> Hi All, >>>> I am trying to find memory leak using libmemunreachable >>>> library in AOSP. i have getting following output on adb shell, but not able >>>> to find line number of code where memory leak present or any backtrace logs >>>> in adb logs. following commands are executed as mentioned in link >>>> <https://android.googlesource.com/platform/system/memory/libmemunreachable/+/master/README.md#:~:text=libmemunreachable%20is%20a%20zero-overhead,differences%20to%20remove%20the%20overhead.> >>>> . >>>> >>>> *Commands:-* >>>> adb root >>>> adb shell setprop libc.debug.malloc.program app_process >>>> adb shell setprop wrap.[process] "\$\@" >>>> adb shell setprop libc.debug.malloc.options backtrace=4 >>>> dumpsys -t 600 meminfo --unreachable [process]. >>>> >>>> *adb shell output:-* >>>> Unreachable memory >>>> 704 bytes in 5 unreachable allocations >>>> ABI: 'arm64' >>>> >>>> 288 bytes unreachable at 7862adf450 >>>> first 20 bytes of contents: >>>> 7862adf450: 88 13 e8 07 00 00 00 00 9e 9f 15 08 00 00 00 00 >>>> ................ >>>> 7862adf460: 2c bb 17 08 00 00 00 00 23 8a 89 08 00 00 00 00 >>>> ,.......#....... >>>> >>>> No. of backtrace frames are 0 in debug logs. is there any way >>>> to enable backtrace in adb logs or to get line no. of source code from >>>> above adb shell output. >>>> >>>> Thanks & Regards, >>>> Shubham Salunkhe >>>> >>>> -- >>>> -- >>>> You received this message because you are subscribed to the "Android >>>> Building" mailing list. >>>> To post to this group, send email to android-...@googlegroups.com >>>> To unsubscribe from this group, send email to >>>> android-buildi...@googlegroups.com >>>> For more options, visit this group at >>>> http://groups.google.com/group/android-building?hl=en >>>> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "Android Building" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to android-buildi...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/android-building/3f5dac22-6aad-4e6a-b840-8afc564fce28n%40googlegroups.com >>>> <https://groups.google.com/d/msgid/android-building/3f5dac22-6aad-4e6a-b840-8afc564fce28n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- > -- > You received this message because you are subscribed to the "Android > Building" mailing list. > To post to this group, send email to android-building@googlegroups.com > To unsubscribe from this group, send email to > android-building+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-building?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "Android Building" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to android-building+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/android-building/b585bb2c-3301-492e-81f0-5c341380146cn%40googlegroups.com > <https://groups.google.com/d/msgid/android-building/b585bb2c-3301-492e-81f0-5c341380146cn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- -- You received this message because you are subscribed to the "Android Building" mailing list. To post to this group, send email to android-building@googlegroups.com To unsubscribe from this group, send email to android-building+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-building?hl=en --- You received this message because you are subscribed to the Google Groups "Android Building" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-building+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/CAJgzZoqJbXLyYmcdDKDFCe4-J8QbficXmaLjTw_Grhi2P9i%3D_w%40mail.gmail.com.