| page.title=Debugging Native Memory Use |
| @jd:body |
| |
| <!-- |
| Copyright 2013 The Android Open Source Project |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <h2 id="malloc_debug">Malloc debug</h2> |
| |
| <p>See <a |
| href="https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md">Malloc |
| Debug</a> and <a |
| href="https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README_api.md">Native |
| Memory Tracking using libc Callbacks</a> for a thorough description of the |
| debugging options available for native memory issues.</p> |
| |
| <h2 id="ddms">Dalvik Debug Monitor Server</h2> |
| |
| <p>You can also use the <a |
| href="https://developer.android.com/studio/profile/ddms.html">Dalvik Debug |
| Monitor Server</a> (DDMS) to obtain a graphical view of Malloc Debug |
| output.</p> |
| |
| <p>To use DDMS, first turn on its native memory UI:</p> |
| <ol> |
| <li>Open <code>~/.android/ddms.cfg</code></li> |
| <li>Add the line: <code>native=true</code></li> |
| </ol> |
| |
| <p>Upon relaunching DDMS and selecting a process, you can switch to the new |
| native allocation tab and populate it with a list of allocations. This is |
| especially useful for debugging memory leaks.</p> |