Bug 1780377 - Add documentation for using Android Studio's native memory profiler with GeckoView. r=geckoview-reviewers,calu DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D152273
This commit is contained in:
Jamie Nicol 2022-07-21 08:18:31 +00:00
Родитель dc4e14088f
Коммит 86e2a29705
1 изменённых файлов: 38 добавлений и 0 удалений

Просмотреть файл

@ -191,6 +191,44 @@ hand.
Managing more debug tabs may require different approaches.
Debug Native Memory Allocations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Android Studio includes a `Native Memory Profiler
<https://developer.android.com/studio/profile/memory-profiler#native-memory-profiler>`_
which works for physical devices running Android 10 and later. In order to
track allocations correctly Gecko must be built with ``jemalloc`` disabled.
Additionally, the native memory profiler appears to only work with ``aarch64``
builds. The following must therefore be present in your ``mozconfig`` file:
.. code::
ac_add_options --target=aarch64
ac_add_options --disable-jemalloc
The resulting profiles are symbolicated correctly in debug builds, however, you
may prefer to use a release build when profiling. Unfortunately a method to
symbolicate using local symbols from the development machine has not yet been
found, therefore in order for the profile to be symbolicated you must prevent
symbols being stripped during the build process. To do so, add the following to
your ``mozconfig``:
.. code::
ac_add_options STRIP_FLAGS=--strip-debug
And the following to ``mobile/android/geckoview/build.gradle``, and additionally
to ``mobile/android/geckoview_example/build.gradle`` if profiling GeckoView
Example, or ``app/build.gradle`` if profiling Fenix, for example.
.. code:: groovy
android {
packagingOptions {
doNotStrip "**/*.so"
}
}
Using Android Studio on Windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~