The Wayback Machine - https://web.archive.org/web/20200930205928/https://github.com/square/leakcanary/issues/1789
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running heap analysis in separate process does not invoke custom OnLeakFoundCallback callback #1789

Open
oliviernotteghem opened this issue Mar 30, 2020 · 1 comment

Comments

@oliviernotteghem
Copy link

@oliviernotteghem oliviernotteghem commented Mar 30, 2020

Description

Not sure if this is the expected behavior or not. I was expected to have background process trigger callback on the main process with leak analysis data.

Steps to Reproduce

  1. Follow https://square.github.io/leakcanary/recipes/#running-the-leakcanary-analysis-in-a-separate-process
  2. Use a app that has custom OnLeakFoundCallback callback
  3. Make sure dumpHeapWhenDebugging is set to true if using debugger
  4. Verify once that callback is not invoked once analysis complete (via debugger breakpoint or logcat)

Expected behavior:

Callback to be invoked in main process.

Version Information

  • LeakCanary version: 2.2
  • Android OS version: API 29
  • Gradle version: n/a
@pyricau
Copy link
Member

@pyricau pyricau commented Apr 21, 2020

Thanks for the bug report, and sorry for the delay.

Currently, the callback (OnHeapAnalyzedListener) must be set in the background process and will be invoked in the background process. Then you'll need to send that result back to the main process your own way.

To be honest, I didn't think this through too much when I ripped out the old code that used a second process. I think the proper approach here would be to provide a default callback in the background process that then kicks things back to the main process and invokes the main process defined callback.

We should do that, and also fully document how to set up LeakCanary with a background process. Contributions welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.